dongxiaoqin 8 місяців тому
батько
коміт
52f7be0994

+ 7 - 1
app/adminapi/lists/master_worker/MasterWorkerLists.php

@@ -143,6 +143,13 @@ class MasterWorkerLists extends BaseAdminDataLists implements ListsSearchInterfa
         if(isset($this->params['id']) && $this->params['id']){
             $where[] =[ 'mw.id','=',$this->params['id']];
         }
+        
+        if(isset($this->params['min_rejection_num']) && is_numeric($this->params['min_rejection_num'])){
+            $where[] =[ 'mw.rejection_num','>=',$this->params['min_rejection_num']];
+        }
+        if(isset($this->params['max_rejection_num']) && is_numeric($this->params['max_rejection_num'])){
+            $where[] =[ 'mw.rejection_num','<=',$this->params['max_rejection_num']];
+        }
         Log::debug('MasterWorker-where:'.json_encode($where));
         return $where;
     }
@@ -198,7 +205,6 @@ class MasterWorkerLists extends BaseAdminDataLists implements ListsSearchInterfa
             $item['work_total'] = $workCount[$item['id']]??0;
             $item['team_name'] = $teams[$item['id']]??'';
             $item['credential_info'] = $images[$item['worker_register_id']]??[];
-            $item['rejection_num'] = MasterWorker::getRejectionNum($item['id']);
         }
         return $list;
     }

+ 3 - 1
app/common/command/RejectionStatistics.php

@@ -70,7 +70,9 @@ class RejectionStatistics extends Command
                     $max_num = max($num_list);
                     if ($max_num > 0) {
                         //更新工程师连续拒单次数
-                        MasterWorker::setRejectionNum($item['id'], $max_num);//记录到缓存中
+                        MasterWorker::where('id', $item['id'])->update([
+                            'rejection_num' => $max_num, //连续拒单次数
+                        ]);
                     }
                 }
                 die;

+ 0 - 11
app/common/model/master_worker/MasterWorker.php

@@ -22,17 +22,6 @@ class MasterWorker extends BaseModel
 {
     protected $name = 'master_worker';
 
-    public static function setRejectionNum($id, $num) {
-        $key = 'master_worker_rejection_num_' . $id;
-        Cache::store('common_redis')->set($key, $num);
-    }
-
-    public static function getRejectionNum($id) {
-        return 0;
-        $key = 'master_worker_rejection_num_' . $id;
-        return (int)Cache::get($key);
-    }
-
     public static function createUserSn($prefix = '', $length = 8)
     {
         $rand_str = '';