wugg 2 years ago
parent
commit
37419ce181
2 changed files with 13 additions and 7 deletions
  1. 5 3
      app/admin/controller/Resign.php
  2. 8 4
      app/command/handleYzOrderData.php

+ 5 - 3
app/admin/controller/Resign.php

@@ -80,11 +80,13 @@ class Resign extends Base
 //            // $where[]=["a.apply_id","in",$role['write']];
 //            $condition .="p.cgderid = {$this->uid} or p.apply_id in (".implode(',',$role['write']).")";
 //        }
-//        $role = $this->checkDataShare();
-//        if (!empty($role[DataGroupModel::$type_全部])) $condition .="p.cgderid = {$this->uid} or p.apply_id in (".implode(',',$role[DataGroupModel::$type_全部]).")";
+
         //超管、库管、库管-张凯旋、boss能看到所有,其他人只能看到自己创建的和身为采购员的单子
         $super_roleid = array_merge([1, 33], config('app.wsm_cgder_role'));
-        if (!in_array($this->roleid, $super_roleid)) $condition .= "p.cgderid = {$this->uid} or p.apply_id = {$this->uid}";
+        if (!in_array($this->roleid, $super_roleid)) {
+        	$role = $this->checkDataShare();
+        if (!empty($role[DataGroupModel::$type_全部])) $condition .="p.cgderid = {$this->uid} or p.apply_id in (".implode(',',$role[DataGroupModel::$type_全部]).")";
+        }
 
         $company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
         if ($company_name !== "") $where[] = ["p.apply_id", 'in', get_company_item_user_by_name($company_name)];

+ 8 - 4
app/command/handleYzOrderData.php

@@ -27,9 +27,12 @@ class handleYzOrderData extends Command
     //处理有赞订单数据
     protected function execute(Input $input, Output $output)
     {
-
+		$limit = Cache::store('redis')->get("YzTimeLimit");
         $c_data = Cache::store('redis')->handler()->rpop(Config::get('app.handle_queue_key'));
-
+        if($limit==1){
+        	return '' ;
+        }
+        Cache::store('redis')->set("YzTimeLimit",1,60);
         if ($c_data){
 
             $c_data = json_decode($c_data, true);
@@ -46,6 +49,7 @@ class handleYzOrderData extends Command
                 if ($c_data['discount_price'] < $platform_yz_info['sale_price'] && $c_data['is_approved'] == '0') {
                     Db::rollback();
                     $this->callbackYz(['status' => 2, 'id' => $c_data['id'], 'reason' => '价格低于系统售价' . $platform_yz_info['sale_price']]);
+                    Cache::store('redis')->set("YzTimeLimit",0);
                     return false;//停止执行后续代码
                 }
 
@@ -579,7 +583,7 @@ class handleYzOrderData extends Command
                 }
 
                 Db::commit();
-
+				Cache::store('redis')->set("YzTimeLimit",0);
                 $output->writeln(date('Y-m-d H:i:s') . '|处理成功,orderCode:' . $orderCode);
 
             } catch (\think\Exception $exception) {
@@ -590,7 +594,7 @@ class handleYzOrderData extends Command
                 //回调更新有赞订单数据
                 $callback_rs = $this->callbackYz(['status' => 8, 'id' => $c_data['id'], 'reason' => $exception->getMessage()]);
                 if ($callback_rs['code'] != 0) $message[] = $callback_rs['message'];
-
+				Cache::store('redis')->set("YzTimeLimit",0);
                 $output->writeln(date('Y-m-d H:i:s') . '|处理失败,' . implode(',', $message));
             }