// +---------------------------------------------------------------------- namespace App\Models; /** * 广告管理-模型 * @author laravel开发员 * @since 2020/11/11 * Class AdModel * @package App\Models */ class AdModel extends BaseModel { // 设置数据表 protected $table = 'ad'; /** * 获取广告信息 * @param int $id * @return array|string * @author laravel开发员 * @since 2020/11/11 */ public function getInfo($id) { $info = parent::getInfo($id); // TODO: Change the autogenerated stub if ($info) { // 广告封面 if ($info['cover']) { $info['cover'] = get_image_url($info['cover']); } // 开始时间 if ($info['start_time']) { $info['start_time'] = datetime($info['start_time']); } // 结束时间 if ($info['end_time']) { $info['end_time'] = datetime($info['end_time']); } // 广告位 if ($info['ad_sort_id']) { $adSortModel = new AdSortModel(); $adSortInfo = $adSortModel->getInfo($info['ad_sort_id']); if ($adSortInfo) { $info['ad_sort_name'] = $adSortInfo['description'] . ">>" . $adSortInfo['loc_id']; } } } return $info; } }