Feedback.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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\common\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. $this->request->filter(['strip_tags', 'trim']);
  43. if ($this->request->isAjax()) {
  44. //如果发送的来源是Selectpage,则转发到Selectpage
  45. if ($this->request->request('keyField')) {
  46. return $this->selectpage();
  47. }
  48. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  49. $list = $this->model
  50. ->with('user')
  51. ->where($where)
  52. ->order($sort, $order)
  53. ->paginate($limit);
  54. $result = array("total" => $list->total(), "rows" => $list->items());
  55. return json($result);
  56. }
  57. return $this->view->fetch();
  58. }
  59. }