|
|
|
@ -1,7 +1,9 @@
|
|
|
|
|
package com.luoo.user.controller;
|
|
|
|
|
|
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Base64;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
@ -165,6 +167,28 @@ public class LoginController extends BaseController {
|
|
|
|
|
redisTemplate.opsForValue().set(redisKey, code, 10, TimeUnit.MINUTES);
|
|
|
|
|
vCode.write(response.getOutputStream());
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 4.1获取图行验证码Base64
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@ApiOperation(value = "4.1获取图行验证码Base64", notes = "4.三次短信验证失败后,获取图形验证码Base64,有效期10分钟")
|
|
|
|
|
@ApiImplicitParams({ @ApiImplicitParam(name = "deviceId", value = "设备id", required = true) })
|
|
|
|
|
@GetMapping("/imageCheckCodeBase64/{deviceId}")
|
|
|
|
|
@GlobalInterceptor
|
|
|
|
|
public Result<String> imageCheckCodeBase64(HttpServletResponse response,
|
|
|
|
|
@VerifyParam(required = true) @PathVariable("deviceId") String deviceId) throws IOException {
|
|
|
|
|
CreateImageCode vCode = new CreateImageCode(130, 38, 5, 10);
|
|
|
|
|
response.setHeader("Pragma", "no-cache");
|
|
|
|
|
response.setHeader("Cache-Control", "no-cache");
|
|
|
|
|
response.setDateHeader("Expires", 0);
|
|
|
|
|
response.setContentType("image/jpeg");
|
|
|
|
|
String code = vCode.getCode();
|
|
|
|
|
String redisKey = Constants.REDIS_KEY_IMAGE_CHECK_CODE + deviceId;
|
|
|
|
|
redisTemplate.opsForValue().set(redisKey, code, 10, TimeUnit.MINUTES);
|
|
|
|
|
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
|
|
|
|
vCode.write(bos);
|
|
|
|
|
return Result.success(Base64.getEncoder().encodeToString(bos.toByteArray()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取支持的手机号国家码
|
|
|
|
|