|
@@ -3,6 +3,7 @@ package com.huimv.apiservice.controller;
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
import com.huimv.common.utils.TokenUtil;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
@@ -11,8 +12,6 @@ import org.apache.commons.codec.binary.Hex;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.security.MessageDigest;
|
|
|
import java.security.NoSuchAlgorithmException;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
/**
|
|
|
* @Project : huimv.shiwan
|
|
|
* @Package : com.huimv.apiservice.controller
|
|
@@ -26,7 +25,7 @@ public class TokenController {
|
|
|
@Value("${renyang.client}")
|
|
|
private String clientId;
|
|
|
|
|
|
- @RequestMapping("/getToken")
|
|
|
+ @GetMapping("/getToken")
|
|
|
public JSONObject getToken(@RequestParam("userId") String userId,
|
|
|
@RequestParam("random") String random,
|
|
|
@RequestParam("timestamp") String timestamp,
|
|
@@ -35,7 +34,7 @@ public class TokenController {
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
|
if (!clientId.equals(userId)) {
|
|
|
- result.put("state", 201);
|
|
|
+ result.put("code", 201);
|
|
|
result.put("msg", "用户信息错误");
|
|
|
return result;
|
|
|
}
|
|
@@ -50,15 +49,15 @@ public class TokenController {
|
|
|
|
|
|
|
|
|
if (!sign.equals(twoSign)) {
|
|
|
- result.put("state", 201);
|
|
|
+ result.put("code", 201);
|
|
|
result.put("msg", "加密方式错误");
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
String token = TokenUtil.sign(userId);
|
|
|
System.out.println(token);
|
|
|
- result.put("state", 200);
|
|
|
- result.put("token", token);
|
|
|
+ result.put("code", 200);
|
|
|
+ result.put("accessToken", token);
|
|
|
|
|
|
return result;
|
|
|
}
|