zhouliwu hace 3 meses
padre
commit
433c54839e

+ 11
- 5
bhkj-delivery-module-backstage/src/main/java/com/bohuikeji/delivery/backstage/service/impl/GmsServiceImpl.java Ver fichero

@@ -38,27 +38,33 @@ public class GmsServiceImpl implements IGmsService {
38 38
         JSONObject jsonObject = new JSONObject();
39 39
         String code=NumberUtils.getRandom(6);
40 40
         log.error("短信验证码发送失败:ip:{},手机号:{}",IpUtil.getIpAddr(request),phone);
41
+        //根据ip查询
41 42
         JSONObject ips= (JSONObject) redisUtil.get("gms:ip:times:"+IpUtil.getIpAddr(request));
42 43
         log.error("短信验证码缓存信息:JSONObject:{}",ips);
43 44
         if(ips != null){
44 45
             ips.put("times",ips.getInteger("times")+1);
45 46
             log.error("短信验证码发送次数:次数:{}",ips.put("times",ips.getInteger("times")+1));
46
-            if(ips.getInteger("times")-1>3){
47
-                ips.put("timing",24);
48
-                redisUtil.set("gms:ip:times:"+IpUtil.getIpAddr(request),ips,Duration.ofHours(24).getSeconds());
49
-                return ips.getString("keys");
50
-            }
51 47
             if(ips.getInteger("times")-1>10){
52 48
                 ips.put("timing",3);
53 49
                 redisUtil.set("gms:ip:times:"+IpUtil.getIpAddr(request),ips,Duration.ofDays(3).getSeconds());
54 50
                 return ips.getString("keys");
55 51
             }
52
+            if(ips.getInteger("times")-1>3){
53
+                ips.put("timing",24);
54
+                redisUtil.set("gms:ip:times:"+IpUtil.getIpAddr(request),ips,Duration.ofHours(24).getSeconds());
55
+                return ips.getString("keys");
56
+            }
56 57
             redisUtil.set("gms:ip:times:"+IpUtil.getIpAddr(request),ips,Duration.ofMinutes(10).getSeconds());
57 58
             return ips.getString("keys");
58 59
         }
60
+        //第一次发送验证码
59 61
         jsonObject.put("keys",code);
60 62
         jsonObject.put("times",1);
63
+        jsonObject.put("timing",10);
61 64
         redisUtil.set("gms:ip:times:"+IpUtil.getIpAddr(request),jsonObject,Duration.ofMinutes(10).getSeconds());
65
+        redisUtil.set("gms:code:txt:"+phone,code,Duration.ofMinutes(10).getSeconds());
66
+        //没有发送记录,正常发送
67
+        YiXunGmsUtils.sendMsg(phone,"SMS_184115918","code", code);
62 68
         return code;
63 69
         /*Object times=redisUtil.get("gms:code:times:"+phone);
64 70
         String code=NumberUtils.getRandom(6);

+ 1
- 1
bhkj-delivery-module-backstage/src/main/resources/application-dev.yml Ver fichero

@@ -19,7 +19,7 @@ spring:
19 19
     host: 114.80.36.153
20 20
     port: 5672
21 21
     username: yfb
22
-    password: yfb
22
+    password: tcjs731462
23 23
     virtual-host: tcjs-dev
24 24
 logging:
25 25
   level:

+ 1
- 1
bhkj-delivery-module-backstage/src/main/resources/application-prod.yml Ver fichero

@@ -19,7 +19,7 @@ spring:
19 19
     host: 114.80.36.153
20 20
     port: 5672
21 21
     username: yfb
22
-    password: yfb
22
+    password: tcjs731462
23 23
     virtual-host: tcjs-prod
24 24
 logging:
25 25
   level:

Loading…
Cancelar
Guardar