whitefang 1 год назад
Родитель
Сommit
74a6d783ab

+ 3 - 1
app/adminapi/logic/works/ServiceWorkLogic.php

@@ -369,6 +369,7 @@ class ServiceWorkLogic extends BaseLogic
      * @return array|false
      */
     public static function detail($params){
+        $work_where = !empty($params['work_sn'])?['work_sn'=>$params['work_sn']]:['id'=>$params['id']];
         $result = ServiceWork::with([
             'worker'=> function(Query $query) {
                 $query->field('id,worker_number,real_name');
@@ -380,7 +381,8 @@ class ServiceWorkLogic extends BaseLogic
                 $query->field('id,work_id,opera_log,create_time');
             }
         ])->append(['id','work_status_text','service_status_text'])
-            ->findOrEmpty($params['id'])->toArray();
+            ->where($work_where)
+            ->findOrEmpty()->toArray();
 
         //师傅工单按钮状态
         $work_service_status = 0;

+ 3 - 0
app/workerapi/controller/WorksController.php

@@ -87,6 +87,9 @@ class WorksController extends BaseApiController
         $params = (new ServiceWorkValidate())->goCheck('detail',[
             'user_id' => $this->userId,
         ]);
+        if(empty($params['id']) && empty($params['work_sn'])){
+            $this->fail('参数错误');
+        }
         $result = ServiceWorkLogic::detail($params);
         if (false === $result) {
             return $this->fail(ServiceWorkLogic::getError());

+ 1 - 1
app/workerapi/validate/ServiceWorkValidate.php

@@ -85,7 +85,7 @@ class ServiceWorkValidate extends BaseValidate
      */
     public function sceneDetail()
     {
-        return $this->only(['id']);
+        return $this->only(['*']);
     }
 
     /**