...
|
...
|
@@ -1408,9 +1408,11 @@ class User extends Api |
|
|
"user_id": 16, //用户ID
|
|
|
"question_id": 1, //题目ID
|
|
|
"createtime": "2020.09.03 19:25", //收藏时间
|
|
|
"is_answer": 1, //是否已作答:0=否,1=是
|
|
|
"question": { //题目信息
|
|
|
"title": "测定混凝土立方体抗压强度时,标准试件的尺寸是( )㎜。", //题目
|
|
|
"type": "1" //题目类型:1=单选题,2=多选题,3=判断题,4=简答题
|
|
|
"type": "1", //题目类型:1=单选题,2=多选题,3=判断题,4=简答题
|
|
|
"target_type":"1" //题目归属类型:1=全能题库,2=模拟试题,3=历年真题,4=每日一练,5=通关密卷
|
|
|
}
|
|
|
}]
|
|
|
}
|
...
|
...
|
@@ -1423,14 +1425,15 @@ class User extends Api |
|
|
$data = QuestionCollect::with(['question'])
|
|
|
->alias('a')
|
|
|
->join('mobile_question b','a.question_id = b.id')
|
|
|
->join('mobile_question_answer c','c.question_id = b.id and c.user_id = '.$this->auth->id,'left')
|
|
|
->where('a.user_id',$this->auth->id)
|
|
|
->order('a.createtime desc')
|
|
|
->field('a.*')
|
|
|
->field('a.*,if(c.id > 0,1,0) is_answer')
|
|
|
->paginate($page_num,false,['page'=>$page])
|
|
|
->each(function($v){
|
|
|
$v['createtime'] = date('Y.m.d H:i',$v['createtime']);
|
|
|
if($v->getRelation('question')){
|
|
|
$v->getRelation('question')->visible(['title','type']);
|
|
|
$v->getRelation('question')->visible(['title','type','target_type']);
|
|
|
}
|
|
|
})->toArray();
|
|
|
$this->success('成功', ['total'=>$data['total'],'list'=>$data['data']]);
|
...
|
...
|
|