|
@@ -36,8 +36,8 @@ class Officer extends MobileBaseController
|
|
|
return '该题库不存在或已删除';
|
|
|
}
|
|
|
|
|
|
- $section_list = OfficerReviewSectionModel::where('rid', $id)->column('name','id');
|
|
|
- $list = OfficerReviewTitleModel::where('rid', $id)->order('no', 'asc')->select()->toArray();
|
|
|
+ $section_list = OfficerReviewSectionModel::where('rid', $id)->column('name', 'id');
|
|
|
+ $list = OfficerReviewTitleModel::where('rid', $id)->order('no', 'asc')->select()->toArray();
|
|
|
if (empty($list)) {
|
|
|
return '该题库不存在或已删除';
|
|
|
}
|
|
@@ -55,31 +55,66 @@ class Officer extends MobileBaseController
|
|
|
|
|
|
public function answerPost()
|
|
|
{
|
|
|
- sleep(3);
|
|
|
- $id = input('id');
|
|
|
- $answer = input('answer');
|
|
|
- $answer_detail = input('answer_detail');
|
|
|
-
|
|
|
+ $answer = input('answer');
|
|
|
+ $answer['rid'] = input('rid');
|
|
|
$officer_answer = OfficerAnswerModel::create($answer);
|
|
|
- $review_title = OfficerReviewTitleModel::where('rid', $id)->column('option,title', 'no');
|
|
|
- $score_sum = 0;
|
|
|
- foreach ($answer_detail as $k => $v) {
|
|
|
- $options = json_decode($review_title[$k]['option'], true);
|
|
|
- $option = $options[$v];
|
|
|
- OfficerAnswerDetailModel::create([
|
|
|
- 'aid' => $officer_answer['id'],
|
|
|
- 'no' => $k,
|
|
|
- 'title' => $review_title[$k]['title'],
|
|
|
- 'score' => $option['score'],
|
|
|
- 'option_title' => $option['title'],
|
|
|
- ]);
|
|
|
- $score_sum += $option['score'];
|
|
|
- }
|
|
|
- OfficerAnswerModel::update(['score' => $score_sum], ['id' => $officer_answer['id']]);
|
|
|
|
|
|
+ ajax_return(0, '', $officer_answer['id']);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function answerDetailPost()
|
|
|
+ {
|
|
|
+ $id = input('id');
|
|
|
+ $aid = input('aid');
|
|
|
+ $no = input('no');
|
|
|
+ $index = input('index');
|
|
|
+
|
|
|
+ $review_title = OfficerReviewTitleModel::where('rid', $id)->where('no', $no)->find();
|
|
|
+ $option = $review_title['option'][$index - 1];
|
|
|
+ OfficerAnswerDetailModel::create([
|
|
|
+ 'aid' => $aid,
|
|
|
+ 'no' => $no,
|
|
|
+ 'title' => $review_title['title'],
|
|
|
+ 'score' => $option['score'],
|
|
|
+ 'option_title' => $option['title'],
|
|
|
+ ]);
|
|
|
+ ajax_return();
|
|
|
+ }
|
|
|
+
|
|
|
+ public function answerFinish()
|
|
|
+ {
|
|
|
+ $aid = input('aid');
|
|
|
+ $score = OfficerAnswerDetailModel::where('aid', $aid)->sum('score');
|
|
|
+ OfficerAnswerModel::update(['score' => $score, 'status' => 2], ['id' => $aid]);
|
|
|
ajax_return();
|
|
|
}
|
|
|
|
|
|
+// public function answerPost()
|
|
|
+// {
|
|
|
+// $id = input('id');
|
|
|
+// $answer = input('answer');
|
|
|
+// $answer_detail = input('answer_detail');
|
|
|
+//
|
|
|
+// $officer_answer = OfficerAnswerModel::create($answer);
|
|
|
+// $review_title = OfficerReviewTitleModel::where('rid', $id)->column('option,title', 'no');
|
|
|
+// $score_sum = 0;
|
|
|
+// foreach ($answer_detail as $k => $v) {
|
|
|
+// $options = json_decode($review_title[$k]['option'], true);
|
|
|
+// $option = $options[$v];
|
|
|
+// OfficerAnswerDetailModel::create([
|
|
|
+// 'aid' => $officer_answer['id'],
|
|
|
+// 'no' => $k,
|
|
|
+// 'title' => $review_title[$k]['title'],
|
|
|
+// 'score' => $option['score'],
|
|
|
+// 'option_title' => $option['title'],
|
|
|
+// ]);
|
|
|
+// $score_sum += $option['score'];
|
|
|
+// }
|
|
|
+// OfficerAnswerModel::update(['score' => $score_sum], ['id' => $officer_answer['id']]);
|
|
|
+//
|
|
|
+// ajax_return();
|
|
|
+// }
|
|
|
+
|
|
|
public function finish()
|
|
|
{
|
|
|
return view();
|