|
@@ -16,6 +16,7 @@ class Index extends Api
|
|
* 首页
|
|
* 首页
|
|
* 热门试卷3个
|
|
* 热门试卷3个
|
|
* 未开始的 + 进行中的
|
|
* 未开始的 + 进行中的
|
|
|
|
+ * 我能参与的
|
|
*/
|
|
*/
|
|
public function index()
|
|
public function index()
|
|
{
|
|
{
|
|
@@ -25,7 +26,7 @@ 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)
|
|
->select();
|
|
->select();
|
|
|
|
|
|
@@ -46,7 +47,7 @@ class Index extends Api
|
|
public function index_trainactive(){
|
|
public function index_trainactive(){
|
|
$now = time();
|
|
$now = time();
|
|
|
|
|
|
- $lists = Db::name('train_active')->field('id,title,logo_image,starttime,endtime')
|
|
|
|
|
|
+ $lists = 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)
|
|
->whereRaw("((endtime = 0) or (endtime > {$now}))")
|
|
->whereRaw("((endtime = 0) or (endtime > {$now}))")
|
|
@@ -55,7 +56,7 @@ class Index extends Api
|
|
->select();
|
|
->select();
|
|
|
|
|
|
foreach($lists as $key => &$val){
|
|
foreach($lists as $key => &$val){
|
|
- $val['image'] = localpath_to_netpath($val['logo_image']);
|
|
|
|
|
|
+ $val['logo_image'] = localpath_to_netpath($val['logo_image']);
|
|
|
|
|
|
if($now < $val['starttime']){
|
|
if($now < $val['starttime']){
|
|
$val['show_status'] = 1;
|
|
$val['show_status'] = 1;
|
|
@@ -65,7 +66,7 @@ class Index extends Api
|
|
$val['show_status'] = 2;
|
|
$val['show_status'] = 2;
|
|
$val['show_status_text'] = '进行中';
|
|
$val['show_status_text'] = '进行中';
|
|
}
|
|
}
|
|
- if($val['endtime'] < $now){
|
|
|
|
|
|
+ if($val['endtime'] < $now || $val['pingjia_time'] > 0){ //时间或评价,都行
|
|
$val['show_status'] = 3;
|
|
$val['show_status'] = 3;
|
|
$val['show_status_text'] = '已结束';
|
|
$val['show_status_text'] = '已结束';
|
|
}
|
|
}
|
|
@@ -92,6 +93,36 @@ class Index extends Api
|
|
$this->success('', $papers);
|
|
$this->success('', $papers);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //培训,更多,所有培训列表
|
|
|
|
+ public function all_trainactive_list(){
|
|
|
|
+ $now = time();
|
|
|
|
+
|
|
|
|
+ $papers = Db::name('train_active')->field('id,title,logo_image,starttime,endtime,pingjia_time')
|
|
|
|
+ ->where('status', 1)
|
|
|
|
+ ->where('deletetime', NULL)
|
|
|
|
+ ->autopage()
|
|
|
|
+ ->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);
|
|
|
|
+ }
|
|
|
|
+
|
|
//在线考试
|
|
//在线考试
|
|
//我的考试
|
|
//我的考试
|
|
//可参加考试
|
|
//可参加考试
|