|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.dsideal.FengHuang.Exam.Controller;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.lang.Validator;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.dsideal.FengHuang.Exam.Model.ExamModel;
|
|
|
|
|
import com.dsideal.FengHuang.Interceptor.EmptyInterface;
|
|
|
|
@ -36,7 +37,7 @@ public class ExamController extends Controller {
|
|
|
|
|
@Before({POST.class})
|
|
|
|
|
@EmptyInterface({"person_name", "ks", "tel"})
|
|
|
|
|
public void addPerson(String person_name, String ks, String tel) {
|
|
|
|
|
if (!cn.hutool.core.lang.Validator.isMobile(tel)) {
|
|
|
|
|
if (!Validator.isMobile(tel)) {
|
|
|
|
|
Kv kv = Kv.create();
|
|
|
|
|
kv.set("success", false);
|
|
|
|
|
kv.set("message", "手机号不正确,请检查后重新输入!");
|
|
|
|
@ -45,7 +46,7 @@ public class ExamController extends Controller {
|
|
|
|
|
}
|
|
|
|
|
Kv kv = em.addPerson(person_name, ks, tel);
|
|
|
|
|
if (kv.getBoolean("success")) {
|
|
|
|
|
CookieUtil.set(getResponse(), "person_id", kv.get("person_id").toString(), false, true);
|
|
|
|
|
CookieUtil.set(getResponse(), "dt_person_id", kv.get("person_id").toString(), false, true);
|
|
|
|
|
}
|
|
|
|
|
renderJson(kv);
|
|
|
|
|
}
|
|
|
|
@ -71,7 +72,7 @@ public class ExamController extends Controller {
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
public void getRemainSecond() {
|
|
|
|
|
String person_id = getCookie("person_id");
|
|
|
|
|
String person_id = getCookie("dt_person_id");
|
|
|
|
|
long remainSecond = em.getRemainSecond(person_id);
|
|
|
|
|
Kv kv = Kv.by("success", true);
|
|
|
|
|
kv.set("remainSecond", remainSecond);
|
|
|
|
@ -87,7 +88,7 @@ public class ExamController extends Controller {
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsNumericInterface({"order_id"})
|
|
|
|
|
public void getQuestion(int order_id, int finish) {
|
|
|
|
|
String person_id = getCookie("person_id");
|
|
|
|
|
String person_id = getCookie("dt_person_id");
|
|
|
|
|
if (finish == 1 && em.HaveJiaoJuan(person_id) <= 0) {
|
|
|
|
|
Kv kv = Kv.by("success", false);
|
|
|
|
|
kv.set("message", "你还没有交卷,不能使用此接口!");
|
|
|
|
@ -109,7 +110,7 @@ public class ExamController extends Controller {
|
|
|
|
|
@EmptyInterface({"reply"})
|
|
|
|
|
@IsNumericInterface({"order_id"})
|
|
|
|
|
public void save(int order_id, String reply) {
|
|
|
|
|
String person_id = getCookie("person_id");
|
|
|
|
|
String person_id = getCookie("dt_person_id");
|
|
|
|
|
int result = em.save(person_id, order_id, reply);
|
|
|
|
|
if (result == -1) {
|
|
|
|
|
Kv kv = Kv.by("success", false);
|
|
|
|
@ -127,7 +128,7 @@ public class ExamController extends Controller {
|
|
|
|
|
*/
|
|
|
|
|
@Before({POST.class})
|
|
|
|
|
public void jiaoJuan() {
|
|
|
|
|
String person_id = getCookie("person_id");
|
|
|
|
|
String person_id = getCookie("dt_person_id");
|
|
|
|
|
em.jiaoJuan(person_id);
|
|
|
|
|
Kv kv = Kv.by("success", true);
|
|
|
|
|
kv.put("message", "保存成功!");
|
|
|
|
@ -140,7 +141,7 @@ public class ExamController extends Controller {
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
public void getPersonAllInfo() {
|
|
|
|
|
String person_id = getCookie("person_id");
|
|
|
|
|
String person_id = getCookie("dt_person_id");
|
|
|
|
|
List<Record> list = em.getPersonAllInfo(person_id);
|
|
|
|
|
renderJson(list);
|
|
|
|
|
}
|
|
|
|
@ -150,7 +151,7 @@ public class ExamController extends Controller {
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
public void getPersonUnFinishCount() {
|
|
|
|
|
String person_id = getCookie("person_id");
|
|
|
|
|
String person_id = getCookie("dt_person_id");
|
|
|
|
|
int count = em.getPersonUnFinishCount(person_id);
|
|
|
|
|
Kv kv = Kv.create();
|
|
|
|
|
kv.set("success", true);
|
|
|
|
@ -163,7 +164,7 @@ public class ExamController extends Controller {
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
public void getPersonAllInfoAfterJiaoJuan() {
|
|
|
|
|
String person_id = getCookie("person_id");
|
|
|
|
|
String person_id = getCookie("dt_person_id");
|
|
|
|
|
if (em.HaveJiaoJuan(person_id) <= 0) {
|
|
|
|
|
Kv kv = Kv.by("success", false);
|
|
|
|
|
kv.set("message", "你还没有交卷,不能使用此接口!");
|
|
|
|
|