vr-shopxo-source/application/service/BannerService.php

40 lines
1.0 KiB
PHP
Raw Normal View History

2018-12-15 05:31:42 +00:00
<?php
namespace app\service;
2018-12-22 16:45:23 +00:00
use think\Db;
2018-12-15 05:31:42 +00:00
/**
* 轮播服务层
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class BannerService
{
/**
2018-12-20 12:02:19 +00:00
* 获取轮播
2018-12-15 05:31:42 +00:00
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-08-29
* @desc description
* @param [array] $params [输入参数]
*/
2018-12-20 12:02:19 +00:00
public static function Banner($params = [])
2018-12-15 05:31:42 +00:00
{
2018-12-22 16:45:23 +00:00
$banner = Db::name('Slide')->field('name,images_url,event_value,event_type,bg_color')->where(['platform'=>APPLICATION_CLIENT_TYPE, 'is_enable'=>1])->order('sort asc')->select();
2018-12-15 05:31:42 +00:00
if(!empty($banner))
{
2018-12-25 10:27:24 +00:00
$images_host = config('images_host');
2018-12-15 05:31:42 +00:00
foreach($banner as &$v)
{
$v['images_url_old'] = $v['images_url'];
$v['images_url'] = $images_host.$v['images_url'];
$v['event_value'] = empty($v['event_value']) ? null : $v['event_value'];
}
}
return $banner;
}
}
?>