Banner.php 627 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use think\Db;
  5. /**
  6. * 示例接口
  7. */
  8. class Banner extends Api
  9. {
  10. protected $noNeedLogin = ['*'];
  11. protected $noNeedRight = ['*'];
  12. //轮播图
  13. public function banner()
  14. {
  15. $where = [
  16. 'status' => 1
  17. ];
  18. $type = input('type',0);
  19. if($type){
  20. $where['type'] = $type;
  21. }
  22. $list = Db::name('banner')->field('id, title, image, url')->where($where)->order('weigh', 'desc')->select();
  23. $list = list_domain_image($list, ['image']);
  24. $this->success(1, $list);
  25. }
  26. }