Przeglądaj źródła

提交测试 同步信息

lvhao 4 dni temu
rodzic
commit
bc9d2dc764

+ 45 - 1
core/CoreApp/controllers/QueueCbt.php

@@ -141,7 +141,51 @@ class QueueCbt extends Start_Controller {
 
 
 
-
+    public function _preGetService(){
+        $where_arr = [
+            //"shop"=>35,//当前店铺为tt-wk
+            //"express"=>83,//快递为tt-cbt
+            "print"=>2,//未打印
+            'printtype'=>1,//打运单
+            "printnumber"=>0,//打印次数
+            'library'=>1,//未出库
+            //'libraryconfirm'=>2,//允许出库
+            "review >"=>4,//审核通过或自动审核
+            "ttsp_status"=>0,//未同步 快递承运商
+       ];
+       //$shop_info = $this->shop->read(35);
+       $shop_list = $this->shop->find_all('1 = 1');
+       $shop_list = array_column($shop_list,null,'id');
+       // if(empty($shop_info)){
+       //     exit("当前店铺不存在");
+       // }
+       $list = $this->db->from("fullordertt")
+           ->select("id,orderinfo,shop,express,print,printnumber,library,review,state")
+           ->where($where_arr)
+           ->where_in("express",[83,85])
+           ->where_not_in('state',[214,217])
+           ->get()->result_array();
+       if(empty($list)){
+           exit("没有符合条件的订单");
+       }
+       foreach($list as $k=>$v){
+           $info = $this->fullordertt->read($v['id']);
+           if(empty($info['extra_text'])){
+               continue;
+           }
+           $extra_text = json_decode($info['extra_text'],true);
+           if(isset($extra_text['server_info'])){
+               continue;
+           }
+           if(isset($shop_list[$info['shop']])){
+                 $r = $this->express_tt->getExpressInfo($info,$shop_list[$info['shop']]);
+                 print_r($info['orderinfo']);
+                 print_r("|");
+                 usleep(10);
+           }
+           
+       }
+    }
 
 
 

+ 11 - 3
core/CoreApp/models/Model_express_tt.php

@@ -240,9 +240,17 @@ class Model_express_tt extends Lin_Model {
         $extra_text = json_decode($info['extra_text'],true);
         $extra_text['server_info'] = $res['data'];
         $info['extra_text'] = json_encode($extra_text,JSON_UNESCAPED_UNICODE);
-        $this->db->update('fullordertt', [
-            'extra_text' => $info['extra_text']
-        ], ['id' => $info['id']]) ;
+        if($info['ttsp_status'] == 0){
+            $this->db->update('fullordertt', [
+                'extra_text' => $info['extra_text'],
+                'ttsp_status' => 1
+            ], ['id' => $info['id']]) ;
+        }else{
+            $this->db->update('fullordertt', [
+                'extra_text' => $info['extra_text']
+            ], ['id' => $info['id']]) ;
+        }
+       
         return  [
             'x'=>1,
             'msg'=>'获取成功1',