|
@@ -42,38 +42,15 @@ class Model_express_tt extends Lin_Model {
|
|
|
'data'=>$info
|
|
|
];
|
|
|
}else if($type == 'FBT'){
|
|
|
- $res = $this->apitt->get_data([$info['orderinfo']],$shop_info[0]);
|
|
|
- if($res['code'] != 0){
|
|
|
- return [
|
|
|
- 'x'=>0,
|
|
|
- 'Description'=>$res['message'],
|
|
|
- ];
|
|
|
+ $extra_text = json_decode($info['extra_text'],true);
|
|
|
+ if(empty($extra_text)){
|
|
|
+ return $this->getFBTOrderDetail($info,$shop_info);
|
|
|
}
|
|
|
- if(!isset($res['data']['orders'])){
|
|
|
- return [
|
|
|
- 'x'=>0,
|
|
|
- 'Description'=>"获取TT订单信息异常",
|
|
|
- ];
|
|
|
- }
|
|
|
- if(empty($res['data']['orders'])){
|
|
|
- return [
|
|
|
- 'x'=>0,
|
|
|
- 'Description'=>"获取TT订单信息异常",
|
|
|
- ];
|
|
|
- }
|
|
|
- if(empty($res['data']['orders'][0]['packages'])){
|
|
|
- return [
|
|
|
- 'x'=>0,
|
|
|
- 'Description'=>"获取TT订单的快递信息",
|
|
|
- ];
|
|
|
- }
|
|
|
- $packages = $res['data']['orders'][0]['packages'];
|
|
|
- $label_list = [];
|
|
|
- print_r($packages);
|
|
|
- foreach($packages as $package){
|
|
|
- $rr = $this->apitt->downloadLabel($package['id'],$shop_info[0],$info);
|
|
|
- print_r($rr);
|
|
|
+ if(empty($extra_text['packages'])){
|
|
|
+ return $this->getFBTOrderDetail($info,$shop_info);
|
|
|
}
|
|
|
+ $info['extra_text'] = $extra_text;
|
|
|
+ return $this->getFBTPackage($info,$shop_info);
|
|
|
|
|
|
}else{
|
|
|
return [
|
|
@@ -83,6 +60,53 @@ class Model_express_tt extends Lin_Model {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ private function getFBTOrderDetail($info,$shop_info){
|
|
|
+ $res = $this->apitt->get_data([$info['orderinfo']],$shop_info[0]);
|
|
|
+ if($res['code'] != 0){
|
|
|
+ return [
|
|
|
+ 'x'=>0,
|
|
|
+ 'Description'=>$res['message'],
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ if(!isset($res['data']['orders'])){
|
|
|
+ return [
|
|
|
+ 'x'=>0,
|
|
|
+ 'Description'=>"获取TT订单信息异常",
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ if(empty($res['data']['orders'])){
|
|
|
+ return [
|
|
|
+ 'x'=>0,
|
|
|
+ 'Description'=>"获取TT订单信息异常",
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ if(empty($res['data']['orders'][0]['packages'])){
|
|
|
+ return [
|
|
|
+ 'x'=>0,
|
|
|
+ 'Description'=>"获取TT订单的快递信息",
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ $packages = $res['data']['orders'][0]['packages'];
|
|
|
+ $label_list = [];
|
|
|
+ print_r($packages);
|
|
|
+ foreach($packages as $package){
|
|
|
+ $rr = $this->apitt->downloadLabel($package['id'],$shop_info[0],$info);
|
|
|
+ print_r($rr);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private function getFBTPackage($info,$shop_info){
|
|
|
+ $extra_text = $info['extra_text'];
|
|
|
+ $packages = $extra_text['packages'];
|
|
|
+ var_dump($packages);
|
|
|
+ $label_list = [];
|
|
|
+ foreach($packages as $package){
|
|
|
+ $rr = $this->apitt->downloadLabel($package['id'],$shop_info[0],$info);
|
|
|
+ print_r($rr);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
private function getOrderDetail($info,$shop_info){
|
|
|
|
|
|
}
|
|
@@ -96,11 +120,11 @@ class Model_express_tt extends Lin_Model {
|
|
|
'Description'=>$res['message'],
|
|
|
];
|
|
|
}
|
|
|
- $extra_info = json_decode($info['extra_info'],true);
|
|
|
- $extra_info['server_info'] = $res['data'];
|
|
|
- $info['extra_info'] = json_encode($extra_info,JSON_UNESCAPED_UNICODE);
|
|
|
+ $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_info' => $info['extra_info']
|
|
|
+ 'extra_text' => $info['extra_text']
|
|
|
], ['id' => $info['id']]) ;
|
|
|
return [
|
|
|
'x'=>1,
|
|
@@ -118,11 +142,11 @@ class Model_express_tt extends Lin_Model {
|
|
|
'Description'=>$res['message'],
|
|
|
];
|
|
|
}
|
|
|
- $extra_info = json_decode($info['extra_info'],true);
|
|
|
- $extra_info['label_info'] = $res['data'];
|
|
|
- $info['extra_info'] = json_encode($extra_info,JSON_UNESCAPED_UNICODE);
|
|
|
+ $extra_text = json_decode($info['extra_text'],true);
|
|
|
+ $extra_text['label_info'] = $res['data'];
|
|
|
+ $info['extra_text'] = json_encode($extra_text,JSON_UNESCAPED_UNICODE);
|
|
|
$this->db->update('fullordertt', [
|
|
|
- 'extra_info' => $info['extra_info']
|
|
|
+ 'extra_text' => $info['extra_text']
|
|
|
], ['id' => $info['id']]) ;
|
|
|
return [
|
|
|
'x'=>1,
|
|
@@ -134,8 +158,8 @@ class Model_express_tt extends Lin_Model {
|
|
|
}
|
|
|
//下载快递面单
|
|
|
private function downloadExpressLabel($info,$shop){
|
|
|
- $extra_info = json_decode($info['extra_info'],true);
|
|
|
- $packageid = $extra_info['label_info']['packageid'];
|
|
|
+ $extra_text = json_decode($info['extra_text'],true);
|
|
|
+ $packageid = $extra_text['label_info']['packageid'];
|
|
|
$res = $this->apitt->downloadLabel($packageid,$shop,$info);
|
|
|
if($res['code'] != 0){
|
|
|
return [
|
|
@@ -143,11 +167,11 @@ class Model_express_tt extends Lin_Model {
|
|
|
'Description'=>$res['message'],
|
|
|
];
|
|
|
}
|
|
|
- $extra_info = json_decode($info['extra_info'],true);
|
|
|
- $extra_info['express_info'] = $res['data'];
|
|
|
- $info['extra_info'] = json_encode($extra_info,JSON_UNESCAPED_UNICODE);
|
|
|
+ $extra_text = json_decode($info['extra_text'],true);
|
|
|
+ $extra_text['express_info'] = $res['data'];
|
|
|
+ $info['extra_text'] = json_encode($extra_text,JSON_UNESCAPED_UNICODE);
|
|
|
$this->db->update('fullordertt', [
|
|
|
- 'extra_info' => $info['extra_info']
|
|
|
+ 'extra_text' => $info['extra_text']
|
|
|
], ['id' => $info['id']]) ;
|
|
|
return [
|
|
|
'x'=>1,
|