Banner.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace addons\ddrive\controller;
  3. use app\common\controller\Api;
  4. use think\Db;
  5. /**
  6. * 轮播图管理
  7. *
  8. * @icon fa fa-circle-o
  9. */
  10. class Banner extends Api
  11. {
  12. // 无需登录的接口,*表示全部
  13. protected $noNeedLogin = '*';
  14. // 无需鉴权的接口,*表示全部
  15. protected $noNeedRight = '*';
  16. public function _initialize()
  17. {
  18. parent::_initialize();
  19. $this->model = new \addons\ddrive\model\Banner;
  20. }
  21. public function index()
  22. {
  23. $map = [];
  24. $map['effectime'] = ['<', time()];
  25. $map['expiretime'] = ['>', time()];
  26. $list = $this->model->where($map)->order('weigh desc,id desc')->select();
  27. $this->success("", $list);
  28. }
  29. public function car_brand(){
  30. $car_brand = Db::name('car_brand')->where('status',1)->select();
  31. foreach ($car_brand as $k=>$v){
  32. $car_brand[$k]['pic_image'] = cdnurl($v['pic_image']);
  33. }
  34. $this->success('成功',['car_brand'=>$car_brand]);
  35. }
  36. public function car_type(){
  37. $brand_id = $this->request->param('brand_id');
  38. $car_type = Db::name('car_type')->where('brand_id',$brand_id)->field('id,brand_id,name,pic_image')->select();
  39. if(!$car_type){
  40. $this->error('该品牌暂无车辆');
  41. }
  42. foreach ($car_type as $k=>$v){
  43. $car_type[$k]['pic_image'] = cdnurl($v['pic_image']);
  44. }
  45. $this->success('成功',['car_type'=>$car_type]);
  46. }
  47. /**
  48. * market_setting
  49. * @des
  50. */
  51. public function market_setting()
  52. {
  53. $list = Db::name('market')->field('dj_status,sf_status,dc_status,ts_status')->find();
  54. $this->success("", $list);
  55. }
  56. }