IssueWorkController.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. /**
  26. * 获取投诉分类
  27. * @return \think\response\Json
  28. * @throws \think\db\exception\DataNotFoundException
  29. * @throws \think\db\exception\DbException
  30. * @throws \think\db\exception\ModelNotFoundException
  31. */
  32. public function getIssueWorkType()
  33. {
  34. $list = DictData::where(['type_value'=>'complaint_type','status'=>1])->field('value,name')->select()->toArray();
  35. return $this->data($list);
  36. }
  37. /**
  38. * 新增投诉
  39. * @return \think\response\Json
  40. */
  41. public function complaint()
  42. {
  43. $params = (new IssueWorkValidate())->post()->goCheck('add', [
  44. 'user_id' => $this->userId,
  45. 'user_info' => $this->userInfo
  46. ]);
  47. $result = IssueWorkLogic::add($params);
  48. if (false === $result) {
  49. return $this->fail(IssueWorkLogic::getError());
  50. }
  51. return $this->success('投诉成功', ['id'=>$result], 1, 1);
  52. }
  53. public function complaintInfo()
  54. {
  55. $params = (new IssueWorkValidate())->goCheck('detail', [
  56. 'user_id' => $this->userId,
  57. ]);
  58. $result = IssueWorkLogic::detail($params);
  59. return $this->data($result);
  60. }
  61. }