Browse Source

修改tkuk获取快递面单 返回信息为空时 程序报错的bug

lvhao 4 ngày trước cách đây
mục cha
commit
01792cb77d
1 tập tin đã thay đổi với 21 bổ sung0 xóa
  1. 21 0
      core/CoreApp/models/Model_express_tt.php

+ 21 - 0
core/CoreApp/models/Model_express_tt.php

@@ -133,6 +133,17 @@ class Model_express_tt extends Lin_Model {
         $packageid = $packages[0]['id'];
         if(!isset($extra_text['is_send'])){
             $rr1 = $this->apitt->ShipByTiktok($packageid,$shop_info[0],$info);
+            if(!isset($rr1['code'])){
+                //避免因为网络原因获取信息失败,再次尝试获取
+                usleep(100);
+                $rr1 = $this->apitt->ShipByTiktok($packageid,$shop_info[0],$info);
+                if(!isset($rr1['code'])){
+                    return [
+                        'x'=>0,
+                        'Description'=>"Tiktok接口异常,请重试",  
+                    ];
+                }
+            }
             if(($rr1['code'] == 0) && ($rr1['message'] == 'Success')){
                 $extra_text['is_send'] = 1;
                 $this->db->update('fullordertt', [
@@ -171,6 +182,16 @@ class Model_express_tt extends Lin_Model {
         // }
 
         $rr = $this->apitt->downloadLabel($packageid,$shop_info[0],$info);
+        if(!isset($rr['code'])){
+            usleep(100);
+            $rr = $this->apitt->downloadLabel($packageid,$shop_info[0],$info);
+            if(!isset($rr['code'])){
+                return [
+                    'x'=>0,
+                    'Description'=>"tiktok获取快递面单异常,请重试",  
+                ];
+            }
+        }
         if($rr['code']!=0){
             return [
                 'x'=>0,