فهرست منبع

cbt队列调整

lvhao 2 روز پیش
والد
کامیت
bbb9eb7531
1فایلهای تغییر یافته به همراه54 افزوده شده و 4 حذف شده
  1. 54 4
      core/CoreApp/controllers/QueueCbt.php

+ 54 - 4
core/CoreApp/controllers/QueueCbt.php

@@ -82,7 +82,7 @@ class QueueCbt extends Start_Controller {
                   $r = $this->express_tt->doCreateCBTLabel($info,$shop_list[$info['shop']]);
                   print_r($info['orderinfo']);
                   print_r("|");
-                  usleep(10);
+                  usleep(500);
             }
         }
         var_dump(date("<br/>执行完成<br/>"));
@@ -130,7 +130,7 @@ class QueueCbt extends Start_Controller {
                   $r = $this->express_tt->doCreateCBTLabel($info,$shop_list[$info['shop']]);
                   print_r($info['orderinfo']);
                   print_r("|");
-                  usleep(10);
+                  usleep(500);
             }
         }
         echo "<br/>";
@@ -144,10 +144,60 @@ class QueueCbt extends Start_Controller {
 
 
     public function _getService(){
-        if(date("H") != 19){
-            exit("当前不是19点执行".date("H"));
+        if(date("H") != 18){
+            exit("当前不是18点执行".date("H"));
         }
+        //允许长时间运行
+        set_time_limit(0);
+        $where_arr = [
+             //"shop"=>35,//当前店铺为tt-wk
+             "express"=>83,//快递为tt-cbt
+             "print"=>2,//未打印
+             'printtype'=>1,//打运单
+             "printnumber"=>0,//打印次数
+             'library'=>1,//未出库
+             //'libraryconfirm'=>2,//允许出库
+             "review >"=>4,//审核通过或自动审核
+        ];
+        //$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_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);
+            }
+            if(date("H") == 20){
+                exit("执行到20点了 不能在执行了");
+            }
+        }
+        echo "<br>执行完成<br/>";   
+        $this->_getServiceAgain(); 
+    }
+
 
+    public function _getServiceAgain(){
         //允许长时间运行
         set_time_limit(0);
         $where_arr = [