| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <?php
- namespace app\workerapi\controller;
- use Exception;
- use app\workerapi\lists\GroupServiceWorkLists;
- use app\adminapi\logic\works\GroupServiceWorkLogic;
- use app\workerapi\validate\GroupServiceWorkValidate;
- /**
- * 拼团工单系统
- */
- class GroupWorksController extends BaseApiController
- {
- /**
- * 服务工单列表-全部
- * @return \think\response\Json
- */
- public function serviceWorkList()
- {
- return $this->dataLists(new GroupServiceWorkLists());
- }
- /**
- * 工单详情
- * @return \think\response\Json
- */
- public function detail()
- {
- try {
- $params = (new GroupServiceWorkValidate())->goCheck('detail',[
- 'master_worker_id' => $this->userId,
- 'user_id' => $this->userId,
- 'user_info' => $this->userInfo,
- ]);
- if(empty($params['id']) && empty($params['work_sn'])){
- $this->fail('参数错误');
- }
- $result = GroupServiceWorkLogic::detail($params);
- if (false === $result) {
- return $this->fail(GroupServiceWorkLogic::getError());
- }
- return $this->data($result);
- } catch (Exception $e) {
- return $this->fail($e->getMessage());
- }
- }
- /**
- * 工程师确认上门
- * @return \think\response\Json
- */
- public function confirmDoor()
- {
- $params = (new GroupServiceWorkValidate())->post()->goCheck('door', [
- 'user_id' => $this->userId,
- 'user_info' => $this->userInfo
- ]);
- $result = GroupServiceWorkLogic::confirmDoor($params);
- if (false === $result) {
- return $this->fail(GroupServiceWorkLogic::getError());
- }
- return $this->success('操作成功,工程师已上门', [], 1, 1);
- }
- /**
- * 工程师确认服务完成
- * @return \think\response\Json
- */
- public function confirmServiceFinish()
- {
- $params = (new GroupServiceWorkValidate())->post()->goCheck('finished', [
- 'user_id' => $this->userId,
- 'user_info' => $this->userInfo
- ]);
- $result = GroupServiceWorkLogic::confirmServiceFinish($params);
- if (false === $result) {
- return $this->fail(GroupServiceWorkLogic::getError());
- }
- return $this->success('操作成功,工程师已确认服务完成', [], 1, 1);
- }
- /**
- * 再次上门
- * @return \think\response\Json
- */
- public function againDoor()
- {
- $params = (new GroupServiceWorkValidate())->post()->goCheck('againDoor', [
- 'user_id' => $this->userId,
- 'user_info' => $this->userInfo
- ]);
- $result = GroupServiceWorkLogic::againDoor($params);
- if (false === $result) {
- return $this->fail(GroupServiceWorkLogic::getError());
- }
- return $this->success('操作成功,已确定新的预约时间', [], 1, 1);
- }
- /**
- * 工程师修改备注
- * @return \think\response\Json
- */
- public function remark()
- {
- $params = (new GroupServiceWorkValidate())->post()->goCheck('remark', [
- 'user_id' => $this->userId,
- 'user_info' => $this->userInfo
- ]);
- $result = GroupServiceWorkLogic::remark($params);
- if (false === $result) {
- return $this->fail(GroupServiceWorkLogic::getError());
- }
- return $this->success('操作成功', [], 1, 1);
- }
- }
|