|
@@ -266,10 +266,15 @@ class Model_express_tt extends Lin_Model {
|
|
|
}
|
|
}
|
|
|
$res = $this->apitt->createLabel($info,$shop_info);
|
|
$res = $this->apitt->createLabel($info,$shop_info);
|
|
|
if(empty($res)){
|
|
if(empty($res)){
|
|
|
- return [
|
|
|
|
|
- 'x'=>0,
|
|
|
|
|
- 'Description'=>"返回信息为空",
|
|
|
|
|
- ];
|
|
|
|
|
|
|
+ if(strpos($res['message'],'These orders are already shipped.')!== false){
|
|
|
|
|
+ return $this->getDetail($info,$shop_info);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ return [
|
|
|
|
|
+ 'x'=>0,
|
|
|
|
|
+ 'Description'=>"返回信息为空",
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
if($res['code'] != 0){
|
|
if($res['code'] != 0){
|
|
|
return [
|
|
return [
|
|
@@ -291,6 +296,51 @@ class Model_express_tt extends Lin_Model {
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private function getDetail($info,$shop_info){
|
|
|
|
|
+ if(is_string($info['extra_text'])){
|
|
|
|
|
+ $extra_text = json_decode($info['extra_text'],true);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $extra_text = $info['extra_text'];
|
|
|
|
|
+ }
|
|
|
|
|
+ $ret_info = $this->apitt->get_detail($info['orderinfo'],$shop_info);
|
|
|
|
|
+ if(empty($ret_info)){
|
|
|
|
|
+ return [
|
|
|
|
|
+ 'x'=>0,
|
|
|
|
|
+ 'Description'=>"获取订单详细信息失败",
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ if($ret_info['code'] != 0){
|
|
|
|
|
+ return [
|
|
|
|
|
+ 'x'=>0,
|
|
|
|
|
+ 'Description'=>"获取订单详细信息失败",
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ if(empty($res['data']['orders'])){
|
|
|
|
|
+ return [
|
|
|
|
|
+ 'x'=>0,
|
|
|
|
|
+ 'Description'=>"获取订单详细信息失败",
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ $packages = $res['data']['orders'][0]['packages'];
|
|
|
|
|
+ if(empty($packages)){
|
|
|
|
|
+ return [
|
|
|
|
|
+ 'x'=>0,
|
|
|
|
|
+ 'Description'=>"包裹信息异常不存在",
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ $package_id = $packages[0]['id'];
|
|
|
|
|
+ $extra_text['label_info'] = ['package_id'=>$package_id];
|
|
|
|
|
+ $info['extra_text'] = json_encode($extra_text,JSON_UNESCAPED_UNICODE);
|
|
|
|
|
+ $this->db->update('fullordertt', [
|
|
|
|
|
+ 'extra_text' => $info['extra_text']
|
|
|
|
|
+ ], ['id' => $info['id']]) ;
|
|
|
|
|
+ return [
|
|
|
|
|
+ 'x'=>1,
|
|
|
|
|
+ 'msg'=>'获取成功2',
|
|
|
|
|
+ 'data'=>$info
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
//下载快递面单
|
|
//下载快递面单
|
|
|
private function downloadExpressLabel($info,$shop){
|
|
private function downloadExpressLabel($info,$shop){
|
|
|
if(is_string($info['extra_text'])){
|
|
if(is_string($info['extra_text'])){
|