云储存
This commit is contained in:
parent
a98d2c3371
commit
39715e1591
|
|
@ -17,6 +17,7 @@ class Api extends Backend
|
|||
{
|
||||
protected $noNeedRight = ['*'];
|
||||
protected $noNeedLogin = ['*'];
|
||||
|
||||
public function select()
|
||||
{
|
||||
$series = Db::query("SELECT a.id,brand_id as pid, a.name FROM series a LEFT JOIN brands b ON a.brand_id = b.id;");
|
||||
|
|
@ -113,7 +114,7 @@ class Api extends Backend
|
|||
if ($out['cover_image']) {
|
||||
$images = explode(',', $out['cover_image']);
|
||||
$images = array_map(function ($url) {
|
||||
return cdnurl($url, true); // true 表示生成绝对路径
|
||||
return cdnurl($url, true) . '?imageMogr2/format/webp'; // true 表示生成绝对路径
|
||||
}, $images);
|
||||
$out['cover_image'] = $images;
|
||||
}
|
||||
|
|
@ -167,9 +168,25 @@ class Api extends Backend
|
|||
$banner = config('site.banner_images'); // 获取轮播图数组
|
||||
$out = [];
|
||||
foreach ($banner as $item) {
|
||||
$out [] = cdnurl($item);
|
||||
$out [] = cdnurl($item) . '?imageMogr2/format/webp';
|
||||
}
|
||||
return $this->return_json($out);
|
||||
if (!empty(config('site.location'))){
|
||||
$location = explode(',', config('site.location') ?? '');
|
||||
}else{
|
||||
$location = [];
|
||||
}
|
||||
$company = [
|
||||
'name' => config('site.name'),
|
||||
'address' => config('site.address') ?? '',
|
||||
'latitude' => $location[0] ?? 31.854870, // 地图坐标
|
||||
'longitude' => $location [1] ?? 106.746141,
|
||||
'phone' => config('site.tel') ??''
|
||||
];
|
||||
$res = [
|
||||
'banner' => $out,
|
||||
'company' => $company
|
||||
];
|
||||
return $this->return_json($res);
|
||||
}
|
||||
|
||||
public function carInfo()
|
||||
|
|
@ -191,13 +208,12 @@ class Api extends Backend
|
|||
if ($car['cover_image']) {
|
||||
$images = explode(',', $car['cover_image']);
|
||||
$images = array_map(function ($url) {
|
||||
return cdnurl($url, true); // true 表示生成绝对路径
|
||||
return cdnurl($url, true) . '?imageMogr2/format/webp'; // true 表示生成绝对路径
|
||||
}, $images);
|
||||
$car['cover_image'] = $images;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$attr_value = AttributeValue::where('car_id', $car['id'])->select();
|
||||
$attr_array = [];
|
||||
foreach ($attr_value as $item) {
|
||||
|
|
@ -288,7 +304,6 @@ class Api extends Backend
|
|||
}
|
||||
|
||||
|
||||
|
||||
private function getAttrIds($attrs)
|
||||
{
|
||||
$attrDB = Attributes::field('id,field_key,input_type')->select();
|
||||
|
|
@ -330,5 +345,4 @@ class Api extends Backend
|
|||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user