IssueWorkController.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. namespace app\api\controller;
  3. use app\api\logic\IssueWorkLogic;
  4. use app\api\validate\IssueWorkValidate;
  5. use app\common\model\dict\DictData;
  6. /**
  7. *
  8. * Class IssueWorkController
  9. * @package app\api\controller
  10. */
  11. class IssueWorkController extends BaseApiController
  12. {
  13. /**
  14. * @notes 投诉列表
  15. * @return \think\response\Json
  16. * @author likeadmin
  17. * @date 2024/07/10 15:06
  18. */
  19. public function lists()
  20. {
  21. $params['user_id'] = $this->userId;
  22. $result = IssueWorkLogic::lists($params);
  23. return $this->data($result);
  24. }
  25. public function is_complaint()
  26. {
  27. $params = (new IssueWorkValidate())->get()->goCheck('isCheck', [
  28. 'user_id' => $this->userId,
  29. 'user_info' => $this->userInfo
  30. ]);
  31. $result = IssueWorkLogic::checkComplaint($params);
  32. if (false === $result) {
  33. return $this->fail(IssueWorkLogic::getError());
  34. }
  35. return $this->success('success', $result, 1, 1);
  36. }
  37. /**
  38. * 获取投诉分类
  39. * @return \think\response\Json
  40. * @throws \think\db\exception\DataNotFoundException
  41. * @throws \think\db\exception\DbException
  42. * @throws \think\db\exception\ModelNotFoundException
  43. */
  44. public function getIssueWorkType()
  45. {
  46. $list = DictData::where(['type_value'=>'complaint_type','status'=>1])->field('value,name')->select()->toArray();
  47. return $this->data($list);
  48. }
  49. /**
  50. * 新增投诉
  51. * @return \think\response\Json
  52. */
  53. public function complaint()
  54. {
  55. $params = (new IssueWorkValidate())->post()->goCheck('add', [
  56. 'user_id' => $this->userId,
  57. 'user_info' => $this->userInfo
  58. ]);
  59. $result = IssueWorkLogic::add($params);
  60. if (false === $result) {
  61. return $this->fail(IssueWorkLogic::getError());
  62. }
  63. return $this->success('投诉成功', ['id'=>$result], 1, 1);
  64. }
  65. public function complaintInfo()
  66. {
  67. $params = (new IssueWorkValidate())->goCheck('detail', [
  68. 'user_id' => $this->userId,
  69. ]);
  70. $result = IssueWorkLogic::detail($params);
  71. return $this->data($result);
  72. }
  73. /**
  74. * 完结投诉
  75. * @return \think\response\Json
  76. */
  77. public function complaintComplete()
  78. {
  79. $params = (new IssueWorkValidate())->post()->goCheck('detail', [
  80. 'user_id' => $this->userId,
  81. 'user_info' => $this->userInfo
  82. ]);
  83. $result = IssueWorkLogic::complaintComplete($params);
  84. if (false === $result) {
  85. return $this->fail(IssueWorkLogic::getError());
  86. }
  87. return $this->success('提交成功', [], 1, 1);
  88. }
  89. }