GroupWorksController.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. 'user_id' => $this->userId,
  29. 'user_info' => $this->userInfo,
  30. ]);
  31. if(empty($params['id']) && empty($params['work_sn'])){
  32. $this->fail('参数错误');
  33. }
  34. $result = GroupServiceWorkLogic::detail($params);
  35. if (false === $result) {
  36. return $this->fail(GroupServiceWorkLogic::getError());
  37. }
  38. return $this->data($result);
  39. } catch (Exception $e) {
  40. return $this->fail($e->getMessage());
  41. }
  42. }
  43. /**
  44. * 工程师确认上门
  45. * @return \think\response\Json
  46. */
  47. public function confirmDoor()
  48. {
  49. $params = (new GroupServiceWorkValidate())->post()->goCheck('door', [
  50. 'user_id' => $this->userId,
  51. 'user_info' => $this->userInfo
  52. ]);
  53. $result = GroupServiceWorkLogic::confirmDoor($params);
  54. if (false === $result) {
  55. return $this->fail(GroupServiceWorkLogic::getError());
  56. }
  57. return $this->success('操作成功,工程师已上门', [], 1, 1);
  58. }
  59. /**
  60. * 工程师确认服务完成
  61. * @return \think\response\Json
  62. */
  63. public function confirmServiceFinish()
  64. {
  65. $params = (new GroupServiceWorkValidate())->post()->goCheck('finished', [
  66. 'user_id' => $this->userId,
  67. 'user_info' => $this->userInfo
  68. ]);
  69. $result = GroupServiceWorkLogic::confirmServiceFinish($params);
  70. if (false === $result) {
  71. return $this->fail(GroupServiceWorkLogic::getError());
  72. }
  73. return $this->success('操作成功,工程师已确认服务完成,等待用户确认中', [], 1, 1);
  74. }
  75. }