12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- class Model_job_get3pewaybillid extends Lin_Model {
- function __construct(){
- parent::__construct();
- $this->load->_model("Model_itsxb","itsxb");
- $this->load->_model("Model_fullorder","fullorder");
- $this->load->_model("Model_fullordersmt","fullordersmt");
- $this->load->_model("Model_fullordertt","fullordertt");
- $this->load->_model("Model_fullorderamz","fullorderamz");
- }
- public function do_job(){
- $end_time = time() - 10 * 3600 * 24;
- $start_time = time() - 2 * 3600 * 24;
- //快递为3pe 76 出库时间十天前 waybillid 不能为空
- $where = "express = 76 and librarytime >= ".$end_time ." and librarytime <= ".$start_time." ";
- $fields = "id,number,waybill,waybillid,librarytime,express";
-
- $this->do_dlz($where,$fields);
- $this->do_tt($where,$fields);
- $this->do_amz($where,$fields);
- $this->do_smt($where,$fields);
- }
- //执行对立站的代码
- private function do_dlz($where,$fields){
- $list = $this->fullorder->find_all($where,$fields);
-
- foreach($list as $item){
- if(empty($item['waybillid'])){
- $this->do_final($item,"fullorder");
- }else{
- continue;
- }
- }
- }
- private function do_tt($where,$fields){
- $list = $this->fullordertt->find_all($where,$fields);
-
- foreach($list as $item){
- if(empty($item['waybillid'])){
- $this->do_final($item,"fullorder");
- }else{
- continue;
- }
- }
- }
- private function do_amz($where,$fields){
- $list = $this->fullorderamz->find_all($where,$fields);
-
- foreach($list as $item){
- if(empty($item['waybillid'])){
- $this->do_final($item,"fullorder");
- }else{
- continue;
- }
- }
- }
- private function do_smt($where,$fields){
- $list = $this->fullordersmt->find_all($where,$fields);
-
- foreach($list as $item){
- if(empty($item['waybillid'])){
- $this->do_final($item,"fullorder");
- }else{
- continue;
- }
- }
- }
- private function do_final($info,$table_name){
- print_r($info);
- sleep(1);
- $res = $this->itsxb->getDetail($info['number']);
- $res = json_decode($res,true);
-
- if(isset($res['code'])){
- if($info['waybill'] != $res['data']['deliveryNo']){
- $this->$table_name->save(['waybillid' => $res['data']['deliveryNo']],$info['id']);
- }
- }
- die;
- }
- }
|