vr-shopxo-source/Application/Service/BannerService.class.php

65 lines
1.8 KiB
PHP
Raw Normal View History

2018-08-29 10:12:20 +00:00
<?php
namespace Service;
/**
2018-09-07 07:04:11 +00:00
* 轮播服务层
2018-08-29 10:12:20 +00:00
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class BannerService
{
/**
2018-11-19 10:42:41 +00:00
* 获取首页轮播 - PC
2018-08-29 10:12:20 +00:00
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-08-29
* @desc description
* @param [array] $params [输入参数]
*/
2018-11-19 10:42:41 +00:00
public static function PC($params = [])
2018-08-29 10:12:20 +00:00
{
// 轮播图片
2018-11-19 10:42:41 +00:00
$banner = M('Slide')->field('name,jump_url,images_url,bg_color')->where(['is_enable'=>1])->order('sort asc')->select();
2018-08-29 10:12:20 +00:00
if(!empty($banner))
{
$images_host = C('IMAGE_HOST');
foreach($banner as &$v)
{
2018-09-26 10:41:25 +00:00
$v['images_url_old'] = $v['images_url'];
2018-08-29 10:12:20 +00:00
$v['images_url'] = $images_host.$v['images_url'];
$v['jump_url'] = empty($v['jump_url']) ? null : $v['jump_url'];
}
}
return $banner;
}
2018-11-19 10:42:41 +00:00
/**
* 获取轮播 - APP
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-08-29
* @desc description
* @param [array] $params [输入参数]
*/
public static function App($params = [])
{
$banner = M('AppSlide')->field('name,images_url,event_value,event_type')->where(['platform'=>APPLICATION_CLIENT_TYPE, 'is_enable'=>1])->order('sort asc')->select();
if(!empty($banner))
{
$images_host = C('IMAGE_HOST');
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;
}
2018-08-29 10:12:20 +00:00
}
?>