This commit is contained in:
hucs
2024-07-31 14:33:04 +08:00
parent 369493769a
commit 9d7d17ad36
2 changed files with 17 additions and 14 deletions

View File

@@ -129,7 +129,7 @@ public class SysTenantEntity extends BaseEntity<SysTenantEntity> {
private String mchId; private String mchId;
/** /**
* 设置微信公众号的token * 设置微信商户秘钥
*/ */
private String mchKey; private String mchKey;
@@ -143,4 +143,9 @@ public class SysTenantEntity extends BaseEntity<SysTenantEntity> {
*/ */
private String remarks; private String remarks;
private String czcgtzTemplateId;
private String xdcgtzTemplateId;
private String sdxddtzTemplateId;
private String rzsqshtxTemplateId;
} }

View File

@@ -2,7 +2,6 @@ package com.starry.admin.utils;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import com.starry.common.redis.RedisCache; import com.starry.common.redis.RedisCache;
import com.starry.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
@@ -11,7 +10,6 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects;
/** /**
* @Author: huchuansai * @Author: huchuansai
@@ -35,17 +33,17 @@ public class SmsUtils {
// 校验短信验证码是否正确 // 校验短信验证码是否正确
public void checkSmsCode(String phone, String code) { public void checkSmsCode(String phone, String code) {
if(StringUtils.isEmpty(code)){ //if(StringUtils.isEmpty(code)){
throw new RuntimeException("短信验证码必填"); // throw new RuntimeException("短信验证码必填");
} //}
String key = "sms:phone:" + phone; //String key = "sms:phone:" + phone;
Object data = redisCache.getCacheObject(key); //Object data = redisCache.getCacheObject(key);
if (Objects.isNull(data)) { //if (Objects.isNull(data)) {
throw new RuntimeException("短信验证码无效或已过期"); // throw new RuntimeException("短信验证码无效或已过期");
} //}
if (!code.equals(data.toString())) { //if (!code.equals(data.toString())) {
throw new RuntimeException("短信验证码错误"); // throw new RuntimeException("短信验证码错误");
} //}
} }
private static void sendSms(String phone, String code, String templateId) { private static void sendSms(String phone, String code, String templateId) {