GroupWorksController.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. namespace app\workerapi\controller;
  3. use Exception;
  4. use app\workerapi\lists\GroupServiceWorkLists;
  5. use app\adminapi\logic\works\GroupServiceWorkLogic;
  6. use app\workerapi\validate\GroupServiceWorkValidate;
  7. /**
  8. * 拼团工单系统
  9. */
  10. class GroupWorksController extends BaseApiController
  11. {
  12. /**
  13. * 服务工单列表-全部
  14. * @return \think\response\Json
  15. */
  16. public function serviceWorkList()
  17. {
  18. return $this->dataLists(new GroupServiceWorkLists());
  19. }
  20. /**
  21. * 工单详情
  22. * @return \think\response\Json
  23. */
  24. public function detail()
  25. {
  26. try {
  27. $params = (new GroupServiceWorkValidate())->goCheck('detail',[
  28. 'master_worker_id' => $this->userId,
  29. 'user_id' => $this->userId,
  30. 'user_info' => $this->userInfo,
  31. ]);
  32. if(empty($params['id']) && empty($params['work_sn'])){
  33. $this->fail('参数错误');
  34. }
  35. $result = GroupServiceWorkLogic::detail($params);
  36. if (false === $result) {
  37. return $this->fail(GroupServiceWorkLogic::getError());
  38. }
  39. return $this->data($result);
  40. } catch (Exception $e) {
  41. return $this->fail($e->getMessage());
  42. }
  43. }
  44. /**
  45. * 工程师确认上门
  46. * @return \think\response\Json
  47. */
  48. public function confirmDoor()
  49. {
  50. $params = (new GroupServiceWorkValidate())->post()->goCheck('door', [
  51. 'user_id' => $this->userId,
  52. 'user_info' => $this->userInfo
  53. ]);
  54. $result = GroupServiceWorkLogic::confirmDoor($params);
  55. if (false === $result) {
  56. return $this->fail(GroupServiceWorkLogic::getError());
  57. }
  58. return $this->success('操作成功,工程师已上门', [], 1, 1);
  59. }
  60. /**
  61. * 工程师确认服务完成
  62. * @return \think\response\Json
  63. */
  64. public function confirmServiceFinish()
  65. {
  66. $params = (new GroupServiceWorkValidate())->post()->goCheck('finished', [
  67. 'user_id' => $this->userId,
  68. 'user_info' => $this->userInfo
  69. ]);
  70. $result = GroupServiceWorkLogic::confirmServiceFinish($params);
  71. if (false === $result) {
  72. return $this->fail(GroupServiceWorkLogic::getError());
  73. }
  74. return $this->success('操作成功,工程师已确认服务完成', [], 1, 1);
  75. }
  76. }