Mr.qian 4 dní pred
rodič
commit
c81790c23d

+ 16 - 6
cif-service/src/main/java/com/txz/cif/service/impl/UserServiceImpl.java

@@ -54,7 +54,7 @@ public class UserServiceImpl extends AbstractService<User> implements UserServic
     //    private OperatorService operatorService;
     
     @Resource
-    private OperatingConfigDubboServiceClient messageDubboServiceClient;
+    private OperatingConfigDubboServiceClient operatingConfigDubboServiceClient;
     
     private static final String SMS_MESSAGE = "Your verification code is %s .It will expire in 5 minutes.Do not share it with anyone";
     
@@ -89,12 +89,22 @@ public class UserServiceImpl extends AbstractService<User> implements UserServic
             return Result.success();
         }
         String code = RandomUtil.randomNumbers(6);
-        // if (csHuaGuService.sendSmsValidCode(phoneNo, String.format(SMS_MESSAGE, code))) {
-        if (jPushService.sendSms(phoneNo, code)) {
-            redisClient.set(key, code, 60 * 5);
-            return Result.fail();
+        String smsType = operatingConfigDubboServiceClient.getConfigByCode("sms_type").getData().getValueInfo();
+        switch (smsType) {
+            case "jpush":
+                if (jPushService.sendSms(phoneNo, code)) {
+                    redisClient.set(key, code, 60 * 5);
+                    return Result.fail();
+                }
+                return Result.success();
+            default:
+            case "cs":
+                if (csHuaGuService.sendSmsValidCode(phoneNo, String.format(SMS_MESSAGE, code))) {
+                    redisClient.set(key, code, 60 * 5);
+                    return Result.fail();
+                }
+                return Result.success();
         }
-        return Result.success();
     }
     
     @Override