Changeset 689 for pro-violet-viettel/sourcecode/application/modules/services/controllers/sendmessage.php
- Timestamp:
- Jan 6, 2015 2:43:22 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-violet-viettel/sourcecode/application/modules/services/controllers/sendmessage.php
r688 r689 217 217 $this->load->model('Services_model'); 218 218 219 $totalpage = 10213; 220 221 $result = $this->Services_model->getCollaborator(2,1,1); 219 //$totalpage = 10213; 220 221 // get total page 222 $totalpage = 1; 223 $default = $this->Services_model->getCollaborator(2,1,1); 224 if($default){ 225 $xml = simplexml_load_string($default); 226 $xml->registerXPathNamespace("S", "http://schemas.xmlsoap.org/soap/envelope/"); 227 $xml = $xml->xpath('//S:Body')[0]; 228 $xml->registerXPathNamespace("ns2", "http://process.wsim.viettel.com/"); 229 $totalpage = (int)$xml->xpath('//return//totalpage')[0]; 230 } 231 232 $result = $this->Services_model->getCollaborator(2,1,$totalpage); 222 233 if ($result){ 223 //$this->xml->parse($result); 224 //$xml = $this->xml; 225 //var_dump($xml); 226 /* 227 $xml = '<?xml version="1.0" ?> 228 <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> 229 <S:Body> 230 <ns2:getListShopAndStaftInfoResponse xmlns:ns2="http://process.wsim.viettel.com/"> 231 <return> 232 <description>Thᅵnh cᅵng</description> 233 <responseCode>0</responseCode> 234 <lst> 235 <address>S? nhᅵ null ???ng Null Khu?i Thu?m Huy?n T?ng B?c K?n B?c K?n</address> 236 <code>1000004001_00001_CTVTMDT</code> 237 <district>001</district> 238 <email></email> 239 <id>20513478</id> 240 <name>V? Th? Luy?n</name> 241 <phone></phone> 242 <precinct>004</precinct> 243 <province>B281</province> 244 </lst> 245 <lst> 246 <address>S? nhᅵ 01 ???ng 01 ??c Xuᅵn B?c K?n B?c K?n</address> 247 <code>1000004001_00002_GPKHDN</code> 248 <district>001</district> 249 <email></email> 250 <id>20536705</id> 251 <name>Chu ?ᅵnh Anh</name> 252 <phone>962143096</phone> 253 <precinct>004</precinct> 254 <province>B281</province> 255 </lst> 256 <lst> 257 <address>S? nhᅵ 186 ???ng Nguy?n Th? Minh Khai T? 8 Nguy?n Th? Minh Khai B?c K?n B?c K?n</address> 258 <code>1000004001_00003_CTVTMDT</code> 259 <district>001</district> 260 <email></email> 261 <id>20519414</id> 262 <name>Hoᅵng Cᅵng Minh</name> 263 <phone>0983532981</phone> 264 <precinct>004</precinct> 265 <province>B281</province> 266 </lst> 267 <page>1</page> 268 <totalpage>102123</totalpage> 269 </return> 270 </ns2:getListShopAndStaftInfoResponse> 271 </S:Body> 272 </S:Envelope>'; 273 */ 274 $xml = $result['result']['original']; 275 $xml = simplexml_load_string($xml); 234 $xml = simplexml_load_string($result); 276 235 $xml->registerXPathNamespace("S", "http://schemas.xmlsoap.org/soap/envelope/"); 277 236 $xml = $xml->xpath('//S:Body')[0]; … … 280 239 foreach($lst as $item){ 281 240 $item = (array)$item; 282 $data = array( 283 'address'=> (string)$item['address'], 284 'code'=>(string)$item['code'], 285 'district'=>(string)$item['district'], 286 'email'=>(string)$item['email'], 287 'id'=>(int)$item['id'], 288 'full_name'=>(string)$item['name'], 289 'cellphone'=>(string)$item['phone'], 290 'precinct'=>(string)$item['precinct'], 291 'province'=>(string)$item['province'], 292 'updated_time'=>date('Y-m-d H:i:s') 293 ); 294 $this->Services_model->syncCollaborator($data); 241 if ((string)$item['phone']){ 242 $data = array( 243 'address'=> (string)$item['address'], 244 'code'=>(string)$item['code'], 245 'district'=>(string)$item['district'], 246 'email'=>(string)$item['email'], 247 'id'=>(int)$item['id'], 248 'full_name'=>(string)$item['name'], 249 'cellphone'=>(string)$item['phone'], 250 'precinct'=>(string)$item['precinct'], 251 'province'=>(string)$item['province'], 252 'updated_time'=>date('Y-m-d H:i:s') 253 ); 254 $this->Services_model->syncCollaborator($data); 255 } 295 256 } 296 $totalpage = (int)$xml->xpath('//return//totalpage')[0];297 //var_dump($totalpage);298 257 }else{ 299 var_dump($result); 258 $logMsg = date('Y-m-d H:i:s') . " Result is null \n"; 259 write_file('./log/sync_collaborator.log', $logMsg, FOPEN_WRITE_CREATE); 300 260 } 301 261 }
Note: See TracChangeset
for help on using the changeset viewer.