WorksController.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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 appointWork()
  51. {
  52. $params = (new ServiceWorkValidate())->post()->goCheck('appoint', [
  53. 'user_id' => $this->userId,
  54. 'user_info' => $this->userInfo
  55. ]);
  56. $result = ServiceWorkLogic::appointWork($params);
  57. if (false === $result) {
  58. return $this->fail(ServiceWorkLogic::getError());
  59. }
  60. return $this->success('预约成功,等待上门', [], 1, 1);
  61. }
  62. /**
  63. * 师傅确认上门
  64. * @return \think\response\Json
  65. */
  66. public function confirmDoor()
  67. {
  68. $params = (new ServiceWorkValidate())->post()->goCheck('door', [
  69. 'user_id' => $this->userId,
  70. 'user_info' => $this->userInfo
  71. ]);
  72. $result = ServiceWorkLogic::confirmDoor($params);
  73. if (false === $result) {
  74. return $this->fail(ServiceWorkLogic::getError());
  75. }
  76. return $this->success('操作成功,师傅已上门', [], 1, 1);
  77. }
  78. /**
  79. * 师傅确认报价单
  80. * @return \think\response\Json
  81. */
  82. public function confirmPrice()
  83. {
  84. $params = (new ServiceWorkValidate())->post()->goCheck('price', [
  85. 'user_id' => $this->userId,
  86. 'user_info' => $this->userInfo
  87. ]);
  88. $result = ServiceWorkLogic::confirmPrice($params);
  89. if (false === $result) {
  90. return $this->fail(ServiceWorkLogic::getError());
  91. }
  92. return $this->success('操作成功,师傅已填写报价单,等待用户确认中', [], 1, 1);
  93. }
  94. /**
  95. * 师傅确认服务完成
  96. * @return \think\response\Json
  97. */
  98. public function confirmServiceFinish()
  99. {
  100. $params = (new ServiceWorkValidate())->post()->goCheck('finished', [
  101. 'user_id' => $this->userId,
  102. 'user_info' => $this->userInfo
  103. ]);
  104. $result = ServiceWorkLogic::confirmServiceFinish($params);
  105. if (false === $result) {
  106. return $this->fail(ServiceWorkLogic::getError());
  107. }
  108. return $this->success('操作成功,师傅已确认服务完成,等待用户确认中', [], 1, 1);
  109. }
  110. /**
  111. * 投诉工单列表
  112. *
  113. * @return \think\response\Json
  114. */
  115. public function issueWorkList()
  116. {
  117. return $this->dataLists(new IssueWorkLists());
  118. }
  119. /**
  120. * 返修工单列表
  121. * @return \think\response\Json
  122. */
  123. public function returnWorkList()
  124. {
  125. return $this->dataLists(new ReturnWorkLists());
  126. }
  127. }