|
|
@@ -278,6 +278,7 @@ class PaperService extends BaseService
|
|
|
->first();
|
|
|
$info['topic'] = $info['topic']? $info['topic']->toArray() : [];
|
|
|
$topicId = isset($info['topic']['id'])? $info['topic']['id'] : 0;
|
|
|
+ $sort = isset($info['topic']['sort'])? $info['topic']['sort'] : 0;
|
|
|
if($info['topic'] && $topicId) {
|
|
|
$info['topic']['accurate'] = isset($info['topic']['accurate'])?$info['topic']['accurate'] : -1;
|
|
|
$info['topic']['topic_analysis'] = isset($info['topic']['topic_analysis'])?$info['topic']['topic_analysis'] : '';
|
|
|
@@ -373,19 +374,19 @@ class PaperService extends BaseService
|
|
|
|
|
|
// 上一题
|
|
|
$info['last'] = ExamTopicModel::where(['paper_id'=> $paperId,'status'=>1,'mark'=>1])
|
|
|
- ->where('id','<', $topicId)
|
|
|
- ->select(['id','topic_name'])
|
|
|
+ ->where('sort','>', $sort)
|
|
|
+ ->select(['id','sort','topic_name'])
|
|
|
->orderBy('sort','asc')
|
|
|
- ->orderBy('id','desc')
|
|
|
+ ->orderBy('id','asc')
|
|
|
->first();
|
|
|
$info['last'] = $info['last']? $info['last']->toArray() :['id'=>0];
|
|
|
|
|
|
// 下一题
|
|
|
$info['next'] = ExamTopicModel::where(['paper_id'=> $paperId,'status'=>1,'mark'=>1])
|
|
|
- ->where('id','>', $topicId)
|
|
|
- ->select(['id','topic_name'])
|
|
|
+ ->where('sort','<', $sort)
|
|
|
+ ->select(['id','sort','topic_name'])
|
|
|
->orderBy('sort','desc')
|
|
|
- ->orderBy('id','asc')
|
|
|
+ ->orderBy('id','desc')
|
|
|
->first();
|
|
|
$info['next'] = $info['next']? $info['next']->toArray() :['id'=>0];
|
|
|
|
|
|
@@ -414,6 +415,7 @@ class PaperService extends BaseService
|
|
|
}
|
|
|
|
|
|
$data = $this->model->where(['type'=>$type,'scene_type'=>$sceneType,'status'=>1,'mark'=>1])
|
|
|
+ ->where('topic_count','>',0)
|
|
|
->orderByRaw('RAND()')
|
|
|
->first();
|
|
|
$data = $data? $data->toArray() : [];
|