| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- // +----------------------------------------------------------------------
- // | 商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2017~2021 https://www.thinkphp.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
- // +----------------------------------------------------------------------
- // | Author: thinkphp <admin@yiovo.com>
- // +----------------------------------------------------------------------
- declare (strict_types=1);
- namespace app\api\model;
- use app\common\model\SchoolNew as SchoolNewModel;
- /**
- * 学校新闻资讯模型类
- * Class SchoolNew
- * @package app\api\model
- */
- class SchoolNew extends SchoolNewModel
- {
- protected $globalScope = [''];
- /**
- * 隐藏字段
- * @var array
- */
- protected $hidden = [
- 'update_time'
- ];
- /**
- * 显示分类列表(有数量限制)
- * @param $schoolId
- * @param int $type
- * @param int $limitRow
- * @return array|mixed
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public static function getShowList($schoolId, $type = 1, $limitRow = 0)
- {
- return parent::getShowList($schoolId, $type, $limitRow); // TODO: Change the autogenerated stub
- }
- /**
- * 详情
- * @param int $id
- * @return SchoolNew|array|null
- */
- public static function getDetail(int $id){
- $info = static::detail($id,['school']);
- if(isset($info['logo'])){
- $info['logo_preview'] = $info['logo']? getPreview($info['logo']) : '';
- }
- $info->hidden(['update_time','status']);
- if($info){
- self::setIncViews($id);
- }
- return $info;
- }
- /**
- * 访问量
- * @param $id
- */
- public static function setIncViews($id){
- (new static())->setInc(['news_id'=> $id], 'views', 1);
- }
- }
|