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