WorksController.php 3.5 KB

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