作者 何书鹏
1 个管道 的构建 失败 耗费 23 秒

代码优化

... ... @@ -759,7 +759,7 @@ class Lists extends Api
$v['finish_hour'] = $finish_hour['finsh_hour'];
}
// 截止日期
$third_study = Db::name('third_study')->where('third_id',$user_id)->field('periodtime')->find();
$third_study = Db::name('third_study')->where('third_id',$user_id)->where('study_id',$v['id'])->field('periodtime')->find();
$v['expirationtime'] = !empty($third_study) ? date('Y-m-d H:i:s',$third_study['periodtime']) : date('Y-m-d H:i:s',$v['expirationtime']);
}
$v['image'] = $qiniu.$v['image'];
... ...
... ... @@ -277,6 +277,14 @@ class User extends Api
->field('a.*,b.expirationtime')
->find();
// 查看用户是否有权限
$third_study = Db::name('third_study')->where('third_id',$user_id)->where('study_id',$data['study_id'])->find();
if(empty($third_study)){
$this->error('您没有该场考试的权限,无法观看视频');
}else{
$third_study['periodtime'] < time() && $this->error('学习期限已过,无法观看视频');
}
//查看播放秒数
$class_detail = Db::name('class_detail')
->where('user_id',$user_id)
... ...