Ver Fonte

工程师工单详情

whitefang há 1 ano atrás
pai
commit
3012364317

+ 24 - 12
app/adminapi/logic/works/ServiceWorkLogic.php

@@ -288,19 +288,31 @@ class ServiceWorkLogic extends BaseLogic
         }
     }
 
+    /**
+     * 工单详情
+     * @param $params
+     * @return array|false
+     */
     public static function detail($params){
-        return ServiceWork::with([
-            'worker'=> function(Query $query) {
-                $query->field('id,worker_number,real_name');
+        try {
+            return ServiceWork::with([
+                'worker'=> function(Query $query) {
+                    $query->field('id,worker_number,real_name');
 //                $query->with('workerRegister');
-            },
-            'rechargeOrder'=>function(Query $query){
-                $query->field('id,order_type,work_id,sn,refund_status,pay_status,pay_time,order_total,order_amount,create_time,update_time')->order(['id'=>'desc']);
-                $query->with(['orderGoods'=>function(Query $query){
-                    $query->field('id,sn,goods_id,goods_name,goods_image,goods_number,good_unit,goods_size,goods_type,goods_brand,base_service_fee,service_total,service_fee')->order(['id'=>'desc']);
-                }]);
-            }
-        ])->append(['work_status_text','service_status_text'])
-            ->findOrEmpty($params['id'])->toArray();
+                },
+                'rechargeOrder'=>function(Query $query){
+                    $query->field('id,order_type,work_id,sn,refund_status,pay_status,pay_time,order_total,order_amount,create_time,update_time')->order(['id'=>'desc']);
+                    $query->with(['orderGoods'=>function(Query $query){
+                        $query->field('id,sn,goods_id,goods_name,goods_image,goods_number,good_unit,goods_size,goods_type,goods_brand,base_service_fee,service_total,service_fee')->order(['id'=>'desc']);
+                    }]);
+                }
+            ])->append(['work_status_text','service_status_text'])
+                ->findOrEmpty($params['id'])->toArray();
+        }catch(\Exception $e){
+            Db::rollback();
+            self::setError($e->getMessage());
+            return false;
+        }
+
     }
 }

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

@@ -49,6 +49,23 @@ class WorksController extends BaseApiController
         return $this->success('领取成功', [], 1, 1);
     }
 
+    /**
+     * 工单详情
+     * @return \think\response\Json
+     */
+    public function detail()
+    {
+        $params = (new ServiceWorkValidate())->goCheck('detail',[
+            'user_id' => $this->userId,
+        ]);
+        $result = ServiceWorkLogic::detail($params);
+        if (false === $result) {
+            return $this->fail(ServiceWorkLogic::getError());
+        }
+        return $this->data($result);
+    }
+
+
     /**
      * 预约上门
      * @return \think\response\Json

+ 1 - 1
app/workerapi/lists/ServiceAssignWorkLists.php

@@ -32,7 +32,7 @@ class ServiceAssignWorkLists extends BaseWorkerDataLists
         ];
 
         $list = ServiceWork::where($where)
-            ->field(['work_sn', 'address', 'title', 'work_status', 'service_status','work_pay_status', 'appointment_time','receive_time','base_service_fee','service_fee'])
+            ->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'])
             ->limit($this->limitOffset, $this->limitLength)
             ->order(['id' => 'desc'])

+ 1 - 1
app/workerapi/lists/ServiceWorkLists.php

@@ -69,7 +69,7 @@ class ServiceWorkLists extends BaseWorkerDataLists
                 break;
         }
         $list = ServiceWork::where($where)
-            ->field(['work_sn', 'address', 'title', 'work_status', 'service_status', 'work_pay_status','appointment_time','receive_time','base_service_fee','service_fee'])
+            ->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'])
             ->limit($this->limitOffset, $this->limitLength)
             ->order(['id' => 'desc'])

+ 9 - 0
app/workerapi/validate/ServiceWorkValidate.php

@@ -77,6 +77,15 @@ class ServiceWorkValidate extends BaseValidate
         return $this->only(['work_sn']);
     }
 
+    /**
+     * 领取场景
+     * @return ServiceWorkValidate
+     */
+    public function sceneDetail()
+    {
+        return $this->only(['id']);
+    }
+
     /**
      * 预约上门场景
      * @return ServiceWorkValidate