Przeglądaj źródła

开启接单后两小时后才能关闭接单

liugc 1 rok temu
rodzic
commit
177bca67f0
1 zmienionych plików z 13 dodań i 4 usunięć
  1. 13 4
      app/workerapi/logic/MasterWorkerLogic.php

+ 13 - 4
app/workerapi/logic/MasterWorkerLogic.php

@@ -154,7 +154,19 @@ class MasterWorkerLogic extends  BaseLogic
                 $params['value'] = FileService::setFileUrl($params['value']);
             }
 
+            $upData = [
+                'id' => $userId,
+                $params['field'] => $params['value']
+            ];
             if($params['field'] == 'accept_order_status'){
+                $masterWorker = MasterWorker::where(['id'=>$userId])->findOrEmpty();
+                $accept_status_time = $masterWorker['accept_status_time'];
+                if($masterWorker['accept_order_status'] ==1 && $params['value'] == 0 && $accept_status_time > 0){
+                    if(time() < ($accept_status_time+2*3600)){
+                        throw new Exception('开启接单后两小时后才能关闭接单');
+                    }
+                }
+                $upData['accept_status_time'] = time();
                 //验证身份证信息是否审核通过
                 $idCard = MasterWorkerInfo::where(['worker_id'=>$userId])->findOrEmpty();
                 if ($idCard->isEmpty()) {
@@ -179,10 +191,7 @@ class MasterWorkerLogic extends  BaseLogic
                 }
             }
 
-            MasterWorker::update([
-                    'id' => $userId,
-                    $params['field'] => $params['value']]
-            );
+            MasterWorker::update($upData);
             return [];
         } catch (\Exception $e) {
             self::$error = $e->getMessage();