Commit 6b7ab953 authored by 郑磊's avatar 郑磊

修改回显验证数据接口

parent 87310464
...@@ -123,13 +123,23 @@ public class CaptchaController { ...@@ -123,13 +123,23 @@ public class CaptchaController {
@RequestMapping("/verify") @RequestMapping("/verify")
@ResponseBody @ResponseBody
public Response<?> verifyCaptcha( public Response<?> verifyCaptcha(
@RequestParam(name = "key") String key @RequestParam(name = "key", required = false) String keyOfQuery,
@RequestBody(required = false) VerifyCaptchaData data
) { ) {
var data = imageCaptchaApplication.getSecondaryData(key); String key = null;
if (data == null) { //如果有POST那么POST优先
if (data != null) {
key = data.getKey();
}
if (key == null) {
key = keyOfQuery;
}
var info = imageCaptchaApplication.getSecondaryData(key);
if (info == null) {
return Response.fail("未验证的数据"); return Response.fail("未验证的数据");
} else { } else {
return Response.success(data); return Response.success(info);
} }
} }
} }
package com.fanjiao.captcha.server.dto;
import lombok.Data;
@Data
public class VerifyCaptchaData {
private String key;
}
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