IssueWorkController.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. namespace app\api\controller;
  3. use app\api\lists\IssueWorkLists;
  4. use app\api\logic\IssueWorkLogic;
  5. use app\api\validate\IssueWorkValidate;
  6. use app\common\model\dict\DictData;
  7. /**
  8. *
  9. * Class IssueWorkController
  10. * @package app\api\controller
  11. */
  12. class IssueWorkController extends BaseApiController
  13. {
  14. /**
  15. * @notes 投诉列表
  16. * @return \think\response\Json
  17. * @author likeadmin
  18. * @date 2024/07/10 15:06
  19. */
  20. public function lists()
  21. {
  22. return $this->dataLists(new IssueWorkLists());
  23. }
  24. /**
  25. * 获取投诉分类
  26. * @return \think\response\Json
  27. * @throws \think\db\exception\DataNotFoundException
  28. * @throws \think\db\exception\DbException
  29. * @throws \think\db\exception\ModelNotFoundException
  30. */
  31. public function getIssueWorkType()
  32. {
  33. $list = DictData::where(['type_value'=>'complaint_type','status'=>1])->field('value,name')->select()->toArray();
  34. return $this->data($list);
  35. }
  36. /**
  37. * 新增投诉
  38. * @return \think\response\Json
  39. */
  40. public function complaint()
  41. {
  42. $params = (new IssueWorkValidate())->post()->goCheck('add', [
  43. 'user_id' => $this->userId,
  44. 'user_info' => $this->userInfo
  45. ]);
  46. $result = IssueWorkLogic::add($params);
  47. if (false === $result) {
  48. return $this->fail(IssueWorkLogic::getError());
  49. }
  50. return $this->success('投诉成功', [], 1, 1);
  51. }
  52. public function complaintInfo()
  53. {
  54. $params = (new IssueWorkValidate())->goCheck('detail', [
  55. 'user_id' => $this->userId,
  56. ]);
  57. $result = IssueWorkLogic::detail($params);
  58. return $this->data($result);
  59. }
  60. }