You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

61 lines
1.3 KiB

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