WorksController.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <?php
  2. namespace app\workerapi\controller;
  3. use app\adminapi\logic\works\ServiceWorkLogic;
  4. use app\workerapi\lists\IssueWorkLists;
  5. use app\workerapi\lists\ReturnWorkLists;
  6. use app\workerapi\lists\ServiceAssignWorkLists;
  7. use app\workerapi\lists\ServiceWorkLists;
  8. use app\workerapi\validate\ServiceWorkValidate;
  9. /**
  10. * 工单系统
  11. */
  12. class WorksController extends BaseApiController
  13. {
  14. /**
  15. * 服务工单列表-全部
  16. * @return \think\response\Json
  17. */
  18. public function serviceWorkList()
  19. {
  20. return $this->dataLists(new ServiceWorkLists());
  21. }
  22. /**
  23. * 派单
  24. * @return \think\response\Json
  25. */
  26. public function assignWorkList()
  27. {
  28. return $this->dataLists(new ServiceAssignWorkLists());
  29. }
  30. /**
  31. * 领取服务单
  32. * @return \think\response\Json
  33. */
  34. public function pickWork()
  35. {
  36. $params = (new ServiceWorkValidate())->post()->goCheck('pick', [
  37. 'user_id' => $this->userId,
  38. 'user_info' => $this->userInfo
  39. ]);
  40. $result = ServiceWorkLogic::pickWork($params);
  41. if (false === $result) {
  42. return $this->fail(ServiceWorkLogic::getError());
  43. }
  44. return $this->success('领取成功', [], 1, 1);
  45. }
  46. /**
  47. * 工单详情
  48. * @return \think\response\Json
  49. */
  50. public function detail()
  51. {
  52. $params = (new ServiceWorkValidate())->goCheck('detail',[
  53. 'user_id' => $this->userId,
  54. ]);
  55. $result = ServiceWorkLogic::detail($params);
  56. if (false === $result) {
  57. return $this->fail(ServiceWorkLogic::getError());
  58. }
  59. return $this->data($result);
  60. }
  61. /**
  62. * 预约上门
  63. * @return \think\response\Json
  64. */
  65. public function appointWork()
  66. {
  67. $params = (new ServiceWorkValidate())->post()->goCheck('appoint', [
  68. 'user_id' => $this->userId,
  69. 'user_info' => $this->userInfo
  70. ]);
  71. $result = ServiceWorkLogic::appointWork($params);
  72. if (false === $result) {
  73. return $this->fail(ServiceWorkLogic::getError());
  74. }
  75. return $this->success('预约成功,等待上门', [], 1, 1);
  76. }
  77. /**
  78. * 师傅确认上门
  79. * @return \think\response\Json
  80. */
  81. public function confirmDoor()
  82. {
  83. $params = (new ServiceWorkValidate())->post()->goCheck('door', [
  84. 'user_id' => $this->userId,
  85. 'user_info' => $this->userInfo
  86. ]);
  87. $result = ServiceWorkLogic::confirmDoor($params);
  88. if (false === $result) {
  89. return $this->fail(ServiceWorkLogic::getError());
  90. }
  91. return $this->success('操作成功,师傅已上门', [], 1, 1);
  92. }
  93. /**
  94. * 师傅确认报价单
  95. * @return \think\response\Json
  96. */
  97. public function confirmPrice()
  98. {
  99. $params = (new ServiceWorkValidate())->post()->goCheck('price', [
  100. 'user_id' => $this->userId,
  101. 'user_info' => $this->userInfo
  102. ]);
  103. $result = ServiceWorkLogic::confirmPrice($params);
  104. if (false === $result) {
  105. return $this->fail(ServiceWorkLogic::getError());
  106. }
  107. return $this->success('操作成功,师傅已填写报价单,等待用户确认中', [], 1, 1);
  108. }
  109. /**
  110. * 师傅确认服务完成
  111. * @return \think\response\Json
  112. */
  113. public function confirmServiceFinish()
  114. {
  115. $params = (new ServiceWorkValidate())->post()->goCheck('finished', [
  116. 'user_id' => $this->userId,
  117. 'user_info' => $this->userInfo
  118. ]);
  119. $result = ServiceWorkLogic::confirmServiceFinish($params);
  120. if (false === $result) {
  121. return $this->fail(ServiceWorkLogic::getError());
  122. }
  123. return $this->success('操作成功,师傅已确认服务完成,等待用户确认中', [], 1, 1);
  124. }
  125. /**
  126. * 投诉工单列表
  127. *
  128. * @return \think\response\Json
  129. */
  130. public function issueWorkList()
  131. {
  132. return $this->dataLists(new IssueWorkLists());
  133. }
  134. /**
  135. * 返修工单列表
  136. * @return \think\response\Json
  137. */
  138. public function returnWorkList()
  139. {
  140. return $this->dataLists(new ReturnWorkLists());
  141. }
  142. }