|
@@ -21,11 +21,18 @@ class Index extends Api
|
|
public function index()
|
|
public function index()
|
|
{
|
|
{
|
|
$now = time();
|
|
$now = time();
|
|
|
|
+
|
|
|
|
+ //非实名,只能看一部分
|
|
|
|
+ $where_auth = "";
|
|
|
|
+ if($this->auth->idcard_status != 1){
|
|
|
|
+ $where_auth = "(find_in_set('".$this->auth->id."',user_ids) )";
|
|
|
|
+ }
|
|
|
|
+
|
|
$papers = Db::name('exam_paper')->field('id,image,title,start_time,end_time,total_score,limit_time,user_ids')
|
|
$papers = Db::name('exam_paper')->field('id,image,title,start_time,end_time,total_score,limit_time,user_ids')
|
|
->where('status', 'NORMAL')
|
|
->where('status', 'NORMAL')
|
|
->where('deletetime', NULL)
|
|
->where('deletetime', NULL)
|
|
-// ->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($where_auth)
|
|
// ->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')
|
|
->order('start_time desc')
|
|
@@ -55,11 +62,17 @@ class Index extends Api
|
|
public function index_trainactive(){
|
|
public function index_trainactive(){
|
|
$now = time();
|
|
$now = time();
|
|
|
|
|
|
|
|
+ //非实名,只能看一部分
|
|
|
|
+ $where_auth = "";
|
|
|
|
+ if($this->auth->idcard_status != 1){
|
|
|
|
+ $where_auth = "(userauth_status = 1) or (find_in_set('".$this->auth->id."',user_ids) )";
|
|
|
|
+ }
|
|
|
|
+
|
|
$lists = Db::name('train_active')->field('id,title,logo_image,starttime,endtime,pingjia_time,pingjia_uid')
|
|
$lists = Db::name('train_active')->field('id,title,logo_image,starttime,endtime,pingjia_time,pingjia_uid')
|
|
->where('status', 1)
|
|
->where('status', 1)
|
|
->where('deletetime', NULL)
|
|
->where('deletetime', NULL)
|
|
->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($where_auth)
|
|
->limit(3)
|
|
->limit(3)
|
|
->order('starttime desc')
|
|
->order('starttime desc')
|
|
->select();
|
|
->select();
|
|
@@ -85,11 +98,17 @@ class Index extends Api
|
|
|
|
|
|
//考试,更多,所有考试列表
|
|
//考试,更多,所有考试列表
|
|
public function all_paper_list(){
|
|
public function all_paper_list(){
|
|
- if($this->auth->idcard_status != 1){$this->success(1,[]);}
|
|
|
|
|
|
+
|
|
|
|
+ //非实名,只能看一部分
|
|
|
|
+ $where_auth = "";
|
|
|
|
+ if($this->auth->idcard_status != 1){
|
|
|
|
+ $where_auth = "(find_in_set('".$this->auth->id."',user_ids) )";
|
|
|
|
+ }
|
|
|
|
|
|
$papers = Db::name('exam_paper')->field('id,image,title,start_time,end_time,total_score,limit_time')
|
|
$papers = Db::name('exam_paper')->field('id,image,title,start_time,end_time,total_score,limit_time')
|
|
->where('status', 'NORMAL')
|
|
->where('status', 'NORMAL')
|
|
->where('deletetime', NULL)
|
|
->where('deletetime', NULL)
|
|
|
|
+ ->where($where_auth)
|
|
->autopage()
|
|
->autopage()
|
|
->select();
|
|
->select();
|
|
|
|
|
|
@@ -119,10 +138,17 @@ class Index extends Api
|
|
$where['endtime'] = ['gt',$now];
|
|
$where['endtime'] = ['gt',$now];
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //非实名,只能看一部分
|
|
|
|
+ $where_auth = "";
|
|
|
|
+ if($this->auth->idcard_status != 1){
|
|
|
|
+ $where_auth = "(userauth_status = 1) or (find_in_set('".$this->auth->id."',user_ids) )";
|
|
|
|
+ }
|
|
|
|
+
|
|
$papers = Db::name('train_active')->field('id,title,logo_image,starttime,endtime,pingjia_time,pingjia_uid')
|
|
$papers = Db::name('train_active')->field('id,title,logo_image,starttime,endtime,pingjia_time,pingjia_uid')
|
|
->where('status', 1)
|
|
->where('status', 1)
|
|
->where('deletetime', NULL)
|
|
->where('deletetime', NULL)
|
|
->where($where)
|
|
->where($where)
|
|
|
|
+ ->where($where_auth)
|
|
->autopage()
|
|
->autopage()
|
|
->order('starttime desc')
|
|
->order('starttime desc')
|
|
->select();
|
|
->select();
|