Преглед на файлове

添加cbt提前生成标签

lvhao преди 4 дни
родител
ревизия
f61207acfb
променени са 3 файла, в които са добавени 77 реда и са изтрити 1 реда
  1. 29 1
      core/CoreApp/controllers/Fullordertt.php
  2. 35 0
      core/CoreApp/controllers/QueueOne.php
  3. 13 0
      core/CoreApp/models/Model_express_tt.php

+ 29 - 1
core/CoreApp/controllers/Fullordertt.php

@@ -45,6 +45,7 @@ class Fullordertt extends Start_Controller {
 		$this->load->_model("Model_logic_order","logic_order");
 		$this->load->_model("Model_excelnew",'excelnew');
 		$this->load->_model("Model_fullordererrors","fullordererrors");
+		$this->load->_model("Model_express_tt","express_tt");
 	}
 	//定义方法的调用规则 获取URI第二段值
     public function _remap($arg,$arg_array)
@@ -241,6 +242,9 @@ class Fullordertt extends Start_Controller {
         {
              $this->_pljzzd();
         }
+		else if($arg == 'cbtlabel'){
+			$this->_cbtlabel($arg_array);
+		}
 		else
 		{
 			 $this->_index();
@@ -719,7 +723,7 @@ class Fullordertt extends Start_Controller {
 				if($ud['express'] == 83){
 					$extra_text = json_decode($ud['extra_text'],true);
 					if(!isset($extra_text['label_info'])){
-						$info_list[$key]['black'] .=  "<p><b class='create_label'  data-id='".$value['id']."'>创建CBT发货标签</b></p>";
+						$info_list[$key]['black'] .=  "<p><b class='create_label'  data-id='".$value['id']."'>创建CBT面单</b></p>";
 					}
 				}
 				$tly = "";
@@ -6589,4 +6593,28 @@ class Fullordertt extends Start_Controller {
             echo json_encode(array('del'=>$id_arr,'msg'=>'操作成功,已暂时隐藏,可继续操作其它订单,刷新即可显示!','success'=>true));
 		}
 	}
+
+
+	public function _cbtlabel($arg_array){
+		$id = $arg_array[0];
+		$info = $this->fullordertt->read($id);
+		if(empty($info)){
+			echo json_encode(array('msg'=>'订单不存在!','success'=>false));exit;
+		}
+		$extra_text = json_decode($info['extra_text'],true);
+		if(isset($extra_text['label_info'])){
+			echo json_encode(array('msg'=>'发货标签已执行,请勿重复操作!','success'=>false));exit;
+		}
+		$shop_info = $this->shop->read($info['shop']);
+		if(empty($shop_info)){
+			echo json_encode(array('msg'=>'店铺不存在!','success'=>false));exit;
+		}
+		$res = $this->express_tt->doCreateCBTLabel($info,$shop_info);
+		if($res['x'] == 0){
+			$msg = isset($res['Description'])?$res['Description']:$res['message'];
+			echo json_encode(array('msg'=>$msg,'success'=>false));exit;
+		}else{
+			echo json_encode(array('msg'=>'操作成功','success'=>true));exit;
+		}
+	}
 }

+ 35 - 0
core/CoreApp/controllers/QueueOne.php

@@ -9,6 +9,8 @@ class QueueOne extends Start_Controller {
         $this->load->_model("Model_logic_crm",'logic_crm');
         $this->load->_model("Model_logic_u9action",'logic_u9action')   ;
         $this->load->_model("Model_logic_u9bh",'logic_u9bh');
+        $this->load->_model("Model_express_tt","express_tt");
+        $this->load->_model("Model_shop","shop");
 	}
     private $ip = ['127.0.0.1','47.105.156.18'];
     //定义方法的调用规则 获取URI第二段值
@@ -32,6 +34,39 @@ class QueueOne extends Start_Controller {
             echo "执行了u9备货";
 
 
+    }
+    //tiktok的cbt发货模式 按照定时任务先创建标签
+    //订单状态要求 已审核 未打印 未出库 允许出库  允许打印    快递必须要是cbt
+    // 当前店铺为tt-wk
+    private function _cbtCreateLabel(){
+        $where_arr = [
+            "shop"=>35,//当前店铺为tt-wk
+            "express"=>83,//快递为tt-cbt
+            "print"=>2,//未打印
+            "printnumber"=>0,//打印次数
+            'library'=>1,//未出库
+            'libraryconfirm'=>2,//允许出库
+            "review >"=>4,//审核通过或自动审核
+        ];
+        $shop_info = $this->shop->read(35);
+        if(empty($shop_info)){
+            exit("当前店铺不存在");
+        }
+        $list = $this->db->from("fullordertt")
+            ->where($where_arr)
+            ->get()->result_array();
+        if(empty($list)){
+            exit("没有符合条件的订单");
+        }
+        foreach($list as $k=>$v){
+            $extra_text = json_encode($v['extra_text'],true);
+            if(isset($extra_text['label_info'])){
+                continue;
+            }
+            $this->express_tt->createLabel($v,$shop_info);
+            sleep(1);
+        }
+        exit("执行完成");
         
     }
 }

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

@@ -305,4 +305,17 @@ class Model_express_tt extends Lin_Model {
     }
 
 
+    public function doCreateCBTLabel($info,$shop_info){
+         //获取快递服务信息
+         $res = $this->getExpressCompany($info,$shop_info[0]);
+         if($res['x'] == 0){
+             return $res;
+         }
+         $res1 = $this->createExpressLabel($res['data'],$shop_info[0]);
+         if($res1['x'] == 0){
+             return $res1;
+         }
+         return $res1;
+    }
+
 }