12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace app\common\model;
- use think\Model;
- // 视频模型
- class VideoIntro extends Model
- {
- public function videoArr()
- {
- return $this->hasMany('VideoUrl','video_id')->where('status',1)
- ->where('is_deleted',0)->where('release_time','< time',date("Y-m-d H:i:s"))
- ->order('sort desc');
- }
- public function videoArr2()
- {
- return $this->hasMany('VideoUrl','video_id')->where('is_deleted',0)->where('release_time','< time',date("Y-m-d H:i:s"))->order('sort asc');
- }
- public function cateDetail()
- {
- return $this->belongsTo('VideoCate','first_classify')->where('status',1)->field('id,title');
- //return $this->hasOne('VideoCate','id','first_classify')->field('id,title');
- /* switch ($type)
- {
- case 1:
- return $this->belongsTo('VideoCate','first_classify');
- break;
- case 2:
- return $this->belongsTo('SeriesVideoCate','first_classify');
- break;
- }*/
- }
- }
|