| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?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);
- }
- }
|