Changeset 710


Ignore:
Timestamp:
Jan 27, 2015 2:00:03 PM (10 years ago)
Author:
namnd
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/sourcecode/application/modules/services/controllers/sendmessage.php

    r709 r710  
    212212        }
    213213       
    214 public function collaborator ()
    215         {
    216                
    217                 error_reporting(E_ALL);
     214        public function collaborator ()
     215        {
     216                error_reporting(E_ALL);
    218217
    219218                $this->load->model('Services_model');
     
    224223                $totalpage = 1;
    225224               
    226                 $default = $this->Services_model->getCollaborator(2,1,1);
    227                 //$default = $this->Services_model->getCollaborator(2,1,10);
     225                $default = $this->Services_model->getCollaborator(2,1,100);
     226                //var_dump($default);
    228227                $data = mb_convert_encoding($default, 'UTF-8', 'ISO-8859-1');
    229                
    230228                if($data){
    231229                        $xml = simplexml_load_string($data);
     
    241239                }
    242240               
    243                
    244                 $result = $this->Services_model->getCollaborator(2,2,$totalpage);
    245                 //var_dump($result);
    246                 $data = mb_convert_encoding($result, 'UTF-8', 'ISO-8859-1');
    247                 echo $data;
    248                 /*
    249                
    250                 if ($data && $data != -1){
    251                         $xml = simplexml_load_string($data);
    252                         $xml->registerXPathNamespace("S", "http://schemas.xmlsoap.org/soap/envelope/");
    253                         $xml = $xml->xpath('//S:Body');
    254                         $xml = $xml[0];
    255                         $xml->registerXPathNamespace("ns2", "http://process.wsim.viettel.com/");
    256                         $lst = $xml->xpath('//return//lst');
    257                         foreach($lst as $item){
    258                                 $item = (array)$item;
    259                                 if ((string)$item['phone']){
     241                for ($i=1; $i<=$totalpage; $i++){
     242                        $result = $this->Services_model->getCollaborator(2,$i,100);
     243                        $data = mb_convert_encoding($result, 'UTF-8', 'ISO-8859-1');
     244                        if($data && $data != -1){
     245                                $xml = simplexml_load_string($data);
     246                                $xml->registerXPathNamespace("S", "http://schemas.xmlsoap.org/soap/envelope/");
     247                                $xml = $xml->xpath('//S:Body');
     248                                $xml = $xml[0];
     249                                $xml->registerXPathNamespace("ns2", "http://process.wsim.viettel.com/");
     250                                $lst = $xml->xpath('//return//lst');
     251                                foreach($lst as $item){
     252                                        $item = (array)$item;
     253                       
    260254                                        $data = array(
    261255                                                        'address'=> (string)$item['address'],
     
    270264                                                        'updated_time'=>date('Y-m-d H:i:s')
    271265                                                );
    272                                         $this->Services_model->syncCollaborator($data);
     266                                        write_file('./log/sync_collaborator.log', var_export($data, TRUE), FOPEN_WRITE_CREATE);
     267                                        if ((string)$item['phone']){
     268                                                $this->Services_model->syncCollaborator($data);
     269                                        }
    273270                                }
     271                        }else{
     272                                $logMsg = date('Y-m-d H:i:s') . " Result is null \n";
     273                                write_file('./log/sync_collaborator.log', $logMsg, FOPEN_WRITE_CREATE);
    274274                        }
    275                 }else{
    276                         $logMsg = date('Y-m-d H:i:s') . " Result is null \n";
    277                         write_file('./log/sync_collaborator.log', $logMsg, FOPEN_WRITE_CREATE);
    278                 }*/
     275                }
    279276        }
    280277}
Note: See TracChangeset for help on using the changeset viewer.