Commit 807d3ef0 authored by 734642908@qq.com's avatar 734642908@qq.com

添加广告列表

parent 3c21d85b
<?php
namespace Home\Controller;
use Think\Controller;
/*
* 广告控制器
*
*/
class AdController extends BaseController
{
//广告列表
public function adList()
{
$type = I('type');
if(empty($type)) {
$result = array(
'c'=>2
,'msg'=>'type参数不存在'
);
} else {
$whereArr = array(
'type'=>$type
,'status'=>1
,'start_time'=>array('lt',date('Y-m-d H:i:s'))
);
$whereArr['_string'] = 'end_time is null or end_time > "'.date('Y-m-d H:i:s').'"';
$field = 'sysid as id,name,img,link,position,type';
$adArr = M("yl_ad","",C("LEWAN_HEZI"))->where($whereArr)->field($field)->order('position')->select();
if(!empty($adArr)) {
$result = array(
'c'=>1
,'msg'=>'获取成功'
,'d'=>array(
'list'=>$adArr
)
);
} else {
$result = array(
'c'=>2
,'msg'=>'暂无数据'
);
}
}
echo $this->formatRes($result);
}
}
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment