FengChaoYu преди 1 ден
родител
ревизия
1dea575bda
променени са 1 файла, в които са добавени 6 реда и са изтрити 1 реда
  1. 6 1
      src/main/java/com/gree/mall/contest/logic/SMSLogic.java

+ 6 - 1
src/main/java/com/gree/mall/contest/logic/SMSLogic.java

@@ -16,6 +16,7 @@ import com.gree.mall.contest.utils.RedisUtil;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
@@ -49,6 +50,9 @@ public class SMSLogic {
     //优惠申请通知
     private final static String TEMPLATE_SMS_DISCOUNT = "SMS_252710269";
 
+    @Value("${spring.profiles.active}")
+    private String profiles;
+
 
 //    @Test
 //    public void test() throws Exception {
@@ -93,7 +97,8 @@ public class SMSLogic {
      */
     public void sendSms(String mobile, String key, String vrifyCode, String sendType) throws Exception {
 
-        if (mobile.equals("13000000000")) {
+        if (mobile.equals("13000000000") && !profiles.equals("prd")) {
+            redisUtil.set(Constant.RedisPrefix.SMS + ":" + sendType + ":13000000000", 1234, 5 * 60);
             return;
         }
         if (StringUtils.isNotBlank(key) && StringUtils.isNotBlank(vrifyCode)) {