count(); $list = $model->page((int)$where['page'], (int)$where['limit']) ->select() ->each(function ($item) { if($item['template_id']==0){ $item['bg_img'] = image_to_base64("http://img.boofly.cn/pop_bg1.jpg"); } if($item['template_id']==1){ $item['bg_img'] = image_to_base64("http://img.boofly.cn/pop_bg2.jpg"); } if($item['template_id']==2){ $item['bg_img'] = image_to_base64("http://img.boofly.cn/pop_bg3.jpg"); } if($item['template_id']==3){ $item['bg_img'] = image_to_base64("http://img.boofly.cn/pop_bg4.jpg"); } if($item['template_id']==4){ $item['bg_img'] = image_to_base64($item['bg_image']); } }); return compact('count', 'list'); } /** * 设置弹屏广告 where 条件 * @param $where * @param null $model * @return mixed */ public static function setWhere($where, $model = null) { $model = $model === null ? new self() : $model; $model = $model->alias('c'); $model = $model->field('c.*'); $model = $model->where('c.mer_id', $where['mer_id']); if (isset($where['store_name']) && $where['store_name'] != '') $model = $model->where('c.id|c.title', 'LIKE', "%$where[store_name]%"); return $model->order('c.id desc')->where('c.is_del', 0); } /** * 详情 */ public static function getOne($id) { $info = self::get($id); return $info; } }