Ad.php 626 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace addons\yexam\service;
  3. class Ad
  4. {
  5. public $model;
  6. public function __construct()
  7. {
  8. $this->model = new \app\admin\model\yexam\Ad();
  9. }
  10. /**
  11. * 获取轮播图列表
  12. * @param $page
  13. * @param $limit
  14. * @throws \think\Exception
  15. */
  16. public function getAdList($page,$limit){
  17. $count = $this->model->count();
  18. if($page){
  19. $data = $this->model->page($page,$limit)->order("weigh asc")->select();
  20. }else{
  21. $data = $this->model->order("weigh asc")->select();
  22. }
  23. return ['total'=>$count,'data'=>$data];
  24. }
  25. }