Commit 87b12ab1 authored by 霍传世's avatar 霍传世

HaiNaAi测试小程序

parent 30033500
......@@ -3,7 +3,6 @@ package com.yuda.hainafacetofaceai.controller;
import com.yuda.hainafacetofaceai.entity.ExamStudent;
import com.yuda.hainafacetofaceai.util.AppUtil;
import org.apache.tomcat.util.security.MD5Encoder;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
......@@ -13,7 +12,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.sql.Time;
import java.util.concurrent.TimeUnit;
@RestController
......@@ -30,8 +28,15 @@ public class LoginController {
public ResponseEntity LoginGo(@RequestBody ExamStudent examStudent){
if(examStudent.getZkzNum().equals("9053464144")&&examStudent.getIdCard().equals("039519938378128944")){
redisTemplate.opsForValue().set("51096606163",new JSONObject(examStudent).toString(),2*60*60, TimeUnit.SECONDS);
return ResponseEntity.ok("51096606163");
JSONObject jsonObject = new JSONObject();
jsonObject.put("Token","51096606163");
jsonObject.put("code",200);
jsonObject.put("message","登录成功");
return ResponseEntity.ok(jsonObject.toString());
}
return ResponseEntity.badRequest().body("账号密码错误");
JSONObject jsonObject = new JSONObject();
jsonObject.put("code",500);
jsonObject.put("message","账号密码错误");
return ResponseEntity.badRequest().body(jsonObject.toString());
}
}
......@@ -4,4 +4,8 @@ spring.redis.host=10.0.0.16
spring.redis.port=6379
spring.redis.password=Camp@Redis2023
spring.redis.database=51
#spring.redis.host=127.0.0.1
#spring.redis.port=6379
#spring.redis.password=
#spring.redis.database=1
spring.redis.timeout=2000
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment