二维码

This commit is contained in:
seesaw
2024-10-23 10:11:28 +08:00
parent 6b658d7af0
commit a52f6bffc0

View File

@ -911,16 +911,16 @@ public class MemberUserServiceImpl implements MemberUserService {
@Override
public String getQRCode() {
Long userId = getLoginUserId();
String redisKey = QRCodeWithJWTUtil.QR_PREFIX+userId;
String url = memberUserRedisTemplate.opsForValue().get(redisKey);
if(StrUtil.isNotEmpty(url)){
return url;
}
// String redisKey = QRCodeWithJWTUtil.QR_PREFIX+userId;
// String url = memberUserRedisTemplate.opsForValue().get(redisKey);
// if(StrUtil.isNotEmpty(url)){
// return url;
// }
String encode = DigestUtil.md5Hex(userId.toString()+System.currentTimeMillis());
String fileName = "QRCode_" + userId + ".png";
String path = QRCodeWithJWTUtil.BASE_PATH+fileName;
QRCodeWithJWTUtil.generateQRCode(encode, 350, 350, path); // 生
memberUserRedisTemplate.opsForValue().set(redisKey,path,180, TimeUnit.SECONDS);
// memberUserRedisTemplate.opsForValue().set(redisKey,path,180, TimeUnit.SECONDS);
memberUserRedisTemplate.opsForValue().set(encode,userId.toString(),180, TimeUnit.SECONDS);
return path;
}