12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- // +----------------------------------------------------------------------
- // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
- // +----------------------------------------------------------------------
- // | 版权所有 2017~2021 LARAVEL研发中心
- // +----------------------------------------------------------------------
- // | 官方网站: http://www.laravel.cn
- // +----------------------------------------------------------------------
- // | Author: laravel开发员 <laravel.qq.com>
- // +----------------------------------------------------------------------
- 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;
- }
- }
|