|
|
@ -2,13 +2,13 @@ |
|
|
|
|
|
|
|
|
|
|
|
namespace app\api\controller; |
|
|
|
namespace app\api\controller; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use app\api\model\City; |
|
|
|
use app\common\model\Banner; |
|
|
|
use app\common\model\Banner; |
|
|
|
use app\common\model\UploadFile; |
|
|
|
|
|
|
|
use think\db\exception\DataNotFoundException; |
|
|
|
use think\db\exception\DataNotFoundException; |
|
|
|
use think\db\exception\DbException; |
|
|
|
use think\db\exception\DbException; |
|
|
|
use think\db\exception\ModelNotFoundException; |
|
|
|
use think\db\exception\ModelNotFoundException; |
|
|
|
use think\response\Json; |
|
|
|
use think\response\Json; |
|
|
|
use app\api\model\City; |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 默认控制器 |
|
|
|
* 默认控制器 |
|
|
|
* Class Index |
|
|
|
* Class Index |
|
|
@ -23,10 +23,10 @@ class Index extends Controller |
|
|
|
|
|
|
|
|
|
|
|
public function getBannerList() |
|
|
|
public function getBannerList() |
|
|
|
{ |
|
|
|
{ |
|
|
|
$list = Banner::where("status", 10)->select()->toArray(); |
|
|
|
$list = Banner::where("status", 10)->with(['image'])->select()->toArray(); |
|
|
|
foreach ($list as &$value) { |
|
|
|
foreach ($list as &$value) { |
|
|
|
$file_path = UploadFile::where('file_id', $value['image_id'])->field('file_id,file_path,file_type,storage,domain')->find(); |
|
|
|
unset($value['image']); |
|
|
|
$value['image'] = getUrl($file_path['file_path'], $file_path['domain']); |
|
|
|
$value['image'] = $value['image_url']; |
|
|
|
} |
|
|
|
} |
|
|
|
return $this->renderSuccess($list); |
|
|
|
return $this->renderSuccess($list); |
|
|
|
} |
|
|
|
} |
|
|
|