Email.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace app\admin\controller\cms;
  3. use app\admin\model\cms\Participate;
  4. use app\common\controller\Backend;
  5. /**
  6. * 邮件管理
  7. *
  8. * @icon fa fa-cny
  9. */
  10. class Email extends Backend
  11. {
  12. /**
  13. * Email模型对象
  14. * @var \app\admin\model\cms\Email
  15. */
  16. protected $model = null;
  17. protected $searchFields = 'id';
  18. public function _initialize()
  19. {
  20. parent::_initialize();
  21. $this->model = new \app\admin\model\cms\Email();
  22. }
  23. /**
  24. * 查看
  25. */
  26. public function index()
  27. {
  28. //设置过滤方法
  29. $this->request->filter(['strip_tags']);
  30. if ($this->request->isAjax()) {
  31. $this->relationSearch = true;
  32. //如果发送的来源是Selectpage,则转发到Selectpage
  33. if ($this->request->request('keyField')) {
  34. return $this->selectpage();
  35. }
  36. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  37. $total = $this->model
  38. ->where($where)
  39. ->order($sort, $order)
  40. ->count();
  41. $list = $this->model->with(['user'])
  42. ->where($where)
  43. ->order($sort, $order)
  44. ->limit($offset, $limit)
  45. ->select();
  46. $result = array("total" => $total, "rows" => $list);
  47. return json($result);
  48. }
  49. return $this->view->fetch();
  50. }
  51. }