You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.5 KiB
69 lines
1.5 KiB
<?php
|
|
|
|
namespace app\mall\logic;
|
|
|
|
|
|
use app\mall\model\MallConfigAdvertise;
|
|
use app\mall\model\MallConfigCarousel;
|
|
|
|
class Config extends Base
|
|
{
|
|
/**
|
|
* 获取商城轮播图
|
|
* @date 2022-10-27
|
|
*/
|
|
public function getCarousel()
|
|
{
|
|
$config_carousel_model = new MallConfigCarousel();
|
|
|
|
// 获取商城轮播图
|
|
$carousel = $config_carousel_model->getAllData([
|
|
['uid', '=', $this->mid]
|
|
],'image,link_url','sort desc');
|
|
|
|
$carousel = empty($carousel) ? [] : $carousel->toArray();
|
|
|
|
return sendSuccessArray([
|
|
// 轮播图
|
|
'carousel' => $carousel
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* 获取商城广告图
|
|
* @date 2022-10-27
|
|
*/
|
|
public function getAdvertise()
|
|
{
|
|
$config_advertise_model = new MallConfigAdvertise();
|
|
|
|
// 获取商城广告图
|
|
$advertise_data = $config_advertise_model->getAllData([
|
|
['uid', '=', $this->mid]
|
|
],'type,image,link_url','id asc');
|
|
|
|
$advertise_data = empty($advertise_data) ? [] : $advertise_data->toArray();
|
|
|
|
// 初始化数据
|
|
$advertise = [
|
|
'top'=>[],
|
|
'bottom'=>[]
|
|
];
|
|
|
|
// 赋值
|
|
foreach ($advertise_data as $k => $v) {
|
|
if ($v['type'] == 1) {
|
|
$advertise['top'][] = $v;
|
|
} else {
|
|
$advertise['bottom'][] = $v;
|
|
}
|
|
}
|
|
|
|
return sendSuccessArray([
|
|
// 广告图
|
|
'advertise' => $advertise
|
|
]);
|
|
}
|
|
|
|
}
|