This commit is contained in:
hucs
2024-07-30 11:01:22 +08:00
parent f48e2d8fe4
commit 83922fdf31
3 changed files with 11 additions and 3 deletions

View File

@@ -2,6 +2,7 @@ package com.starry.admin.utils;
import cn.hutool.core.util.RandomUtil;
import com.starry.common.redis.RedisCache;
import com.starry.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;
@@ -34,6 +35,9 @@ public class SmsUtils {
// 校验短信验证码是否正确
public void checkSmsCode(String phone, String code) {
if(StringUtils.isEmpty(code)){
throw new RuntimeException("短信验证码必填");
}
String key = "sms:phone:" + phone;
Object data = redisCache.getCacheObject(key);
if (Objects.isNull(data)) {