|
@@ -16,11 +16,69 @@ class Trainactive extends Api
|
|
|
protected $noNeedRight = ['test2'];
|
|
|
|
|
|
//我的培训
|
|
|
- public function my_sinin_list(){
|
|
|
+ public function my_list(){
|
|
|
+ $now = time();
|
|
|
|
|
|
+
|
|
|
+ $papers = Db::name('train_active')->field('id,title,logo_image,starttime,endtime,pingjia_time')
|
|
|
+ ->where('status', 1)
|
|
|
+ ->where('deletetime', NULL)
|
|
|
+ ->where("(userauth_status = 1) or (find_in_set('".$this->auth->id."',user_ids) )")
|
|
|
+ ->autopage()
|
|
|
+ ->order('starttime desc')
|
|
|
+ ->select();
|
|
|
+
|
|
|
+ foreach($papers as $key => &$val){
|
|
|
+ $val['logo_image'] = localpath_to_netpath($val['logo_image']);
|
|
|
+
|
|
|
+ if($now < $val['starttime']){
|
|
|
+ $val['show_status'] = 1;
|
|
|
+ $val['show_status_text'] = '待开始';
|
|
|
+ }
|
|
|
+ if($val['starttime'] < $now && $now < $val['endtime']){
|
|
|
+ $val['show_status'] = 2;
|
|
|
+ $val['show_status_text'] = '进行中';
|
|
|
+ }
|
|
|
+ if($val['endtime'] < $now || $val['pingjia_time'] > 0){ //时间或评价,都行
|
|
|
+ $val['show_status'] = 3;
|
|
|
+ $val['show_status_text'] = '已结束';
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->success('', $papers);
|
|
|
}
|
|
|
+
|
|
|
//培训详情
|
|
|
public function info(){
|
|
|
+ $id = input('id',0);
|
|
|
+ $info = Db::name('train_active')->field('id,title,logo_image,starttime,endtime,pingjia,pingjia_time,pingjia_uid')
|
|
|
+ ->where('id', $id)
|
|
|
+ ->find();
|
|
|
+
|
|
|
+ if(!empty($info)){
|
|
|
+ $info['logo_image'] = localpath_to_netpath($info['logo_image']);
|
|
|
+
|
|
|
+ $info['pingjia_nickname'] = '';
|
|
|
+ if($info['pingjia_uid']){
|
|
|
+ $info['pingjia_nickname'] = Db::name('user')->where('id',$info['pingjia_uid'])->value('nickname');
|
|
|
+ }
|
|
|
+
|
|
|
+ $now = time();
|
|
|
+ if($now < $info['starttime']){
|
|
|
+ $val['show_status'] = 1;
|
|
|
+ $val['show_status_text'] = '待开始';
|
|
|
+ }
|
|
|
+ if($info['starttime'] < $now && $now < $info['endtime']){
|
|
|
+ $info['show_status'] = 2;
|
|
|
+ $info['show_status_text'] = '进行中';
|
|
|
+ }
|
|
|
+ if($info['endtime'] < $now || $info['pingjia_time'] > 0){ //时间或评价,都行
|
|
|
+ $info['show_status'] = 3;
|
|
|
+ $info['show_status_text'] = '已结束';
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->success(1,$info);
|
|
|
}
|
|
|
|
|
|
|