whitefang před 1 rokem
rodič
revize
f3a79c9eae

+ 2 - 1
app/workerapi/controller/MasterWorkerMessageController.php

@@ -54,7 +54,7 @@ class MasterWorkerMessageController extends BaseApiController
         $prompt_result = MasterWorkerMessageLogic::orderPrompt($this->userId);
         //新工单领取
         if(!empty($prompt_result)){
-            $result = ['confirm_code'=>101,'msg'=>'您有新的工单未领取,请点击领取','data'=>[]];
+            $result = ['confirm_code'=>101,'msg'=>'您有新的工单未领取,请点击领取','data'=>$prompt_result];
             return $this->success('操作成功', $result, 1, 0);
         }
 
@@ -65,6 +65,7 @@ class MasterWorkerMessageController extends BaseApiController
             return $this->success('操作成功', $result, 1, 0);
         }
 
+
         return $this->success('操作成功', $result, 1, 0);
     }
 

+ 19 - 2
app/workerapi/logic/MasterWorkerMessageLogic.php

@@ -122,9 +122,26 @@ class MasterWorkerMessageLogic extends  BaseLogic
         return true;
     }
 
+    /**
+     * @param $userId
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
     public static function orderPrompt($userId)
     {
-        $count = ServiceWork::where(['master_worker_id'=>$userId,'work_status'=> 1] )->count('id');
-        return $count?:false;
+        $where = [
+            'master_worker_id'=>$userId,
+            'approval'=>1,//派单的时候默认审核了
+            'work_status'=>1,
+        ];
+
+        return ServiceWork::where($where)
+            ->field(['id', 'work_sn', 'address', 'title', 'work_status', 'service_status','work_pay_status', 'appointment_time','receive_time','base_service_fee','service_fee'])
+            ->append(['work_status_text','service_status_text'])
+            ->order(['appointment_time' => 'asc'])//上门时间排序
+            ->select()
+            ->toArray();
     }
 }