|
@@ -26,8 +26,9 @@ class Index extends Api
|
|
->where('deletetime', NULL)
|
|
->where('deletetime', NULL)
|
|
// ->whereRaw("((start_time = 0 and end_time = 0) or (start_time < {$now} and end_time > {$now}))")
|
|
// ->whereRaw("((start_time = 0 and end_time = 0) or (start_time < {$now} and end_time > {$now}))")
|
|
->whereRaw("((end_time = 0) or (end_time > {$now}))")
|
|
->whereRaw("((end_time = 0) or (end_time > {$now}))")
|
|
- ->where('find_in_set(:user_ids,user_ids)', ['user_ids' => $this->auth->id])
|
|
|
|
|
|
+// ->where('find_in_set(:user_ids,user_ids)', ['user_ids' => $this->auth->id])
|
|
->limit(3)
|
|
->limit(3)
|
|
|
|
+ ->order('start_time desc')
|
|
->select();
|
|
->select();
|
|
|
|
|
|
foreach($papers as $key => &$val){
|
|
foreach($papers as $key => &$val){
|
|
@@ -53,6 +54,7 @@ class Index extends Api
|
|
->whereRaw("((endtime = 0) or (endtime > {$now}))")
|
|
->whereRaw("((endtime = 0) or (endtime > {$now}))")
|
|
//->where("(userauth_status = 1) or (find_in_set('".$this->auth->id."',user_ids) )")
|
|
//->where("(userauth_status = 1) or (find_in_set('".$this->auth->id."',user_ids) )")
|
|
->limit(3)
|
|
->limit(3)
|
|
|
|
+ ->order('starttime desc')
|
|
->select();
|
|
->select();
|
|
|
|
|
|
foreach($lists as $key => &$val){
|
|
foreach($lists as $key => &$val){
|
|
@@ -95,12 +97,27 @@ class Index extends Api
|
|
|
|
|
|
//培训,更多,所有培训列表
|
|
//培训,更多,所有培训列表
|
|
public function all_trainactive_list(){
|
|
public function all_trainactive_list(){
|
|
- $now = time();
|
|
|
|
|
|
+ $type = input('type',1);
|
|
|
|
+ $now = time();
|
|
|
|
+
|
|
|
|
+ $where = [];
|
|
|
|
+ if($type == 1){
|
|
|
|
+ $where['starttime'] = ['gt',$now];
|
|
|
|
+ }
|
|
|
|
+ if($type == 2){
|
|
|
|
+ $where['starttime'] = ['lt',$now];
|
|
|
|
+ $where['endtime'] = ['gt',$now];
|
|
|
|
+ }
|
|
|
|
+ if($type == 3){
|
|
|
|
+ $where = 'endtime < '.$now.' or pingjia_time > 0';
|
|
|
|
+ }
|
|
|
|
|
|
$papers = Db::name('train_active')->field('id,title,logo_image,starttime,endtime,pingjia_time')
|
|
$papers = Db::name('train_active')->field('id,title,logo_image,starttime,endtime,pingjia_time')
|
|
->where('status', 1)
|
|
->where('status', 1)
|
|
->where('deletetime', NULL)
|
|
->where('deletetime', NULL)
|
|
|
|
+ ->where($where)
|
|
->autopage()
|
|
->autopage()
|
|
|
|
+ ->order('starttime desc')
|
|
->select();
|
|
->select();
|
|
|
|
|
|
foreach($papers as $key => &$val){
|
|
foreach($papers as $key => &$val){
|
|
@@ -131,9 +148,9 @@ class Index extends Api
|
|
$now = time();
|
|
$now = time();
|
|
$papers = Db::name('exam_paper')->field('id,title,start_time,end_time,total_score,limit_time')
|
|
$papers = Db::name('exam_paper')->field('id,title,start_time,end_time,total_score,limit_time')
|
|
->where('status', 'NORMAL')
|
|
->where('status', 'NORMAL')
|
|
|
|
+ ->where('deletetime', NULL)
|
|
->whereRaw("((start_time = 0 and end_time = 0) or (start_time < {$now} and end_time > {$now}))")
|
|
->whereRaw("((start_time = 0 and end_time = 0) or (start_time < {$now} and end_time > {$now}))")
|
|
->where('find_in_set(:user_ids,user_ids)', ['user_ids' => $this->auth->id])
|
|
->where('find_in_set(:user_ids,user_ids)', ['user_ids' => $this->auth->id])
|
|
- ->where('deletetime', NULL)
|
|
|
|
->autopage()
|
|
->autopage()
|
|
->select();
|
|
->select();
|
|
|
|
|