GroupWorksController.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. /**
  77. * 再次上门
  78. * @return \think\response\Json
  79. */
  80. public function againDoor()
  81. {
  82. $params = (new GroupServiceWorkValidate())->post()->goCheck('againDoor', [
  83. 'user_id' => $this->userId,
  84. 'user_info' => $this->userInfo
  85. ]);
  86. $result = GroupServiceWorkLogic::againDoor($params);
  87. if (false === $result) {
  88. return $this->fail(GroupServiceWorkLogic::getError());
  89. }
  90. return $this->success('操作成功,已确定新的预约时间', [], 1, 1);
  91. }
  92. /**
  93. * 工程师修改备注
  94. * @return \think\response\Json
  95. */
  96. public function remark()
  97. {
  98. $params = (new GroupServiceWorkValidate())->post()->goCheck('remark', [
  99. 'user_id' => $this->userId,
  100. 'user_info' => $this->userInfo
  101. ]);
  102. $result = GroupServiceWorkLogic::remark($params);
  103. if (false === $result) {
  104. return $this->fail(GroupServiceWorkLogic::getError());
  105. }
  106. return $this->success('操作成功', [], 1, 1);
  107. }
  108. }