Thumb.php 967 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace app\api\controller\service;
  3. use app\common\controller\Api;
  4. /**
  5. * 首页接口
  6. */
  7. class Thumb extends Api
  8. {
  9. protected $noNeedLogin = ['getList', 'getText'];
  10. protected $noNeedRight = ['*'];
  11. /**
  12. * 首页轮播图
  13. * @return void
  14. * @throws \think\db\exception\DataNotFoundException
  15. * @throws \think\db\exception\ModelNotFoundException
  16. * @throws \think\exception\DbException
  17. */
  18. public function getList()
  19. {
  20. $list = model('app\api\model\service\Thumb')
  21. ->field('image,type,config_text_id,goods_id,jump_id')
  22. ->where(['state'=>1])
  23. ->order('id desc')
  24. ->select();
  25. foreach ($list as $key=>$val)
  26. {
  27. $list[$key]['jump'] = $val['type'] == 3?\app\api\model\service\Jump::where(['id'=>$val['jump_id']])->value('url'):'';
  28. }
  29. $this->success('信息返回成功',$list);
  30. }
  31. }