Feedback.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace app\admin\controller;
  3. use app\common\controller\Backend;
  4. use app\common\Enum\StatusEnum;
  5. use app\common\Enum\FeedbackEnum;
  6. /**
  7. * 意见反馈
  8. *
  9. * @icon fa fa-circle-o
  10. */
  11. class Feedback extends Backend
  12. {
  13. protected $relationSearch = true;
  14. protected $searchFields = 'id,phone,content';
  15. /**
  16. * Feedback模型对象
  17. * @var \app\common\model\Feedback
  18. */
  19. protected $model = null;
  20. public function _initialize()
  21. {
  22. parent::_initialize();
  23. $this->model = new \app\admin\model\Feedback;
  24. $this->view->assign("statusList",StatusEnum::getMap());
  25. $this->assignconfig('statusSearchList',json_encode(StatusEnum::getMap()));
  26. $this->view->assign("processStatusList",FeedbackEnum::getProcessStatusMap());
  27. $this->assignconfig('processStatusSearchList',json_encode(FeedbackEnum::getProcessStatusMap()));
  28. $this->view->assign("feedbackTypeList",FeedbackEnum::getFeedbackTypeMap());
  29. $this->assignconfig('feedbackTypeSearchList',json_encode(FeedbackEnum::getFeedbackTypeMap()));
  30. }
  31. /**
  32. * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
  33. * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
  34. * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
  35. */
  36. /**
  37. * 查看
  38. */
  39. public function index()
  40. {
  41. //当前是否为关联查询
  42. //设置过滤方法
  43. $this->request->filter(['strip_tags', 'trim']);
  44. if ($this->request->isAjax()) {
  45. //如果发送的来源是Selectpage,则转发到Selectpage
  46. if ($this->request->request('keyField')) {
  47. return $this->selectpage();
  48. }
  49. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  50. $list = $this->model
  51. ->with('user')
  52. ->where($where)
  53. ->order($sort, $order)
  54. ->paginate($limit);
  55. $result = array("total" => $list->total(), "rows" => $list->items());
  56. return json($result);
  57. }
  58. return $this->view->fetch();
  59. }
  60. }