You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
838 B
PHP
39 lines
838 B
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: xmy 280564871@qq.com
|
|
* Date: 2017/4/8
|
|
* Time: 11:12
|
|
*/
|
|
|
|
namespace App\Model;
|
|
|
|
class AdvModel extends BaseModel{
|
|
|
|
|
|
public function getAdv($pos_name,$limit){
|
|
$map['p.name'] = $pos_name;
|
|
$map['a.status'] = 1;
|
|
$now = NOW_TIME;
|
|
$map['a.start_time'] = ['lt',$now];
|
|
$data = $this->table("tab_adv as a")
|
|
->field("a.title,a.data,a.url")
|
|
->join("left join tab_adv_pos p on p.id=a.pos_id")
|
|
->where($map)
|
|
->where("a.end_time > $now or a.end_time = 0")
|
|
->order("a.sort desc")
|
|
->limit($limit)
|
|
->select();
|
|
foreach ($data as $key => $val) {
|
|
$cover = get_cover($val['data'],'path');
|
|
if(strpos($cover, 'http')!==false){
|
|
$cover = $cover;
|
|
}else{
|
|
$cover = 'http://'.$_SERVER['HTTP_HOST'].$cover;
|
|
}
|
|
|
|
$data[$key]['data'] = $cover;
|
|
}
|
|
return $data;
|
|
}
|
|
} |