44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller\Banners;
|
|
|
|
use app\BaseController;
|
|
use app\common\model\Banners\Banner as ModelBanner;
|
|
use app\Request;
|
|
use think\Validate;
|
|
use think\exception\ValidateException;
|
|
use think\facade\Filesystem;
|
|
use app\common\arw\adjfut\src\Excel;
|
|
use app\common\arw\adjfut\src\UploadFile;
|
|
use think\facade\Db;
|
|
use app\common\exception\Tool;
|
|
use think\facade\Env;
|
|
|
|
|
|
class Banner extends BaseController
|
|
{
|
|
/**
|
|
* 获取轮播图列表
|
|
*/
|
|
public function getBannerList(Request $request): array
|
|
{
|
|
$params = $request->param();
|
|
$con = [];
|
|
$this->validate($params, ['banner_location|轮播图位置' => 'require']);
|
|
|
|
$query = ModelBanner::where($con)
|
|
->field([
|
|
'banner_img',
|
|
'banner_location',
|
|
])
|
|
->where('banner_location', $params['banner_location'])
|
|
->order('banner_order', 'asc')
|
|
->select();
|
|
|
|
return msg(0, "获取轮播图列表成功!", [
|
|
'data' => $query,
|
|
'count' => count($query)
|
|
]);
|
|
}
|
|
}
|