jialuyu před 11 hodinami
rodič
revize
58f90262bf

+ 3 - 3
ruoyi-admin/src/main/resources/application-dev.yml

@@ -47,9 +47,9 @@ spring:
           driverClassName: com.mysql.cj.jdbc.Driver
           # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
           # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
-          url: jdbc:mysql://116.62.136.107:4563/sj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
+          url: jdbc:mysql://106.14.104.158:3306/sj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
           username: sj
-          password: naPb4MrXkSNa5f4m
+          password: PTn87SF6mZCmS7ji
 #        # 从库数据源
 #        slave:
 #          lazy: true
@@ -103,7 +103,7 @@ spring.data:
     # 数据库索引
     database: 0
     # redis 密码必须配置
-    # password: ruoyi123
+    # password: 123456
     # 连接超时时间
     timeout: 10s
     # 是否开启ssl

+ 2 - 1
ruoyi-admin/src/main/resources/application-prod.yml

@@ -50,7 +50,7 @@ spring:
           driverClassName: com.mysql.cj.jdbc.Driver
           # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
           # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
-          url: jdbc:mysql://localhost:3306/sj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
+          url: jdbc:mysql://106.14.104.158:3306/sj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
           username: sj
           password: PTn87SF6mZCmS7ji
 #        # 从库数据源
@@ -106,6 +106,7 @@ spring.data:
     database: 0
     # redis 密码必须配置
     # password: ruoyi123
+    password: 123456
     # 连接超时时间
     timeout: 10s
     # 是否开启ssl

+ 26 - 20
ruoyi-modules/ruoyi-main/src/main/java/org/dromara/main/controller/PortalAuthController.java

@@ -103,30 +103,31 @@ public class PortalAuthController extends BaseController {
         // 验证码缓存5分钟
         RedisUtils.setCacheObject(key, code, Duration.ofMinutes(Constants.CAPTCHA_EXPIRATION));
 
-        if ("dev".equalsIgnoreCase(activeProfile)) {
-            log.info("开发环境短信验证码: phone={}, code={}", phonenumber, code);
+        // 非生产环境不发送真实短信,仅打印验证码日志
+//        if (!"prod".equalsIgnoreCase(activeProfile)) {
+            log.info("测试环境短信验证码: phone={}, code={},也可使用万能验证码 123456", phonenumber, code);
             return R.ok();
-        }
+//        }
 
         // 发送短信验证码
         // 验证码模板id 需要在短信服务商配置
-        String templateId = "";
-        LinkedHashMap<String, String> map = new LinkedHashMap<>(1);
-        map.put("code", code);
-
-        try {
-            SmsBlend smsBlend = SmsFactory.getSmsBlend("config1");
-            SmsResponse smsResponse = smsBlend.sendMessage(phonenumber, templateId, map);
-            if (!smsResponse.isSuccess()) {
-                log.error("验证码短信发送异常 => {}", smsResponse);
-                return R.fail(smsResponse.getData().toString());
-            }
-        } catch (Exception e) {
-            log.error("验证码短信发送异常 => {}", e.getMessage());
-            throw new ServiceException("短信发送失败,请稍后重试");
-        }
-
-        return R.ok();
+//        String templateId = "";
+//        LinkedHashMap<String, String> map = new LinkedHashMap<>(1);
+//        map.put("code", code);
+//
+//        try {
+//            SmsBlend smsBlend = SmsFactory.getSmsBlend("config1");
+//            SmsResponse smsResponse = smsBlend.sendMessage(phonenumber, templateId, map);
+//            if (!smsResponse.isSuccess()) {
+//                log.error("验证码短信发送异常 => {}", smsResponse);
+//                return R.fail(smsResponse.getData().toString());
+//            }
+//        } catch (Exception e) {
+//            log.error("验证码短信发送异常 => {}", e.getMessage());
+//            throw new ServiceException("短信发送失败,请稍后重试");
+//        }
+//
+//        return R.ok();
     }
 
     /**
@@ -273,6 +274,11 @@ public class PortalAuthController extends BaseController {
     }
 
     private void validateSmsCode(String phonenumber, String smsCode) {
+        // 万能验证码 123456,测试阶段使用
+        if ("123456".equals(smsCode)) {
+            log.info("测试万能验证码登录: phone={}", phonenumber);
+            return;
+        }
         String cacheKey = GlobalConstants.CAPTCHA_CODE_KEY + phonenumber;
         String cachedCode = RedisUtils.getCacheObject(cacheKey);
         if (StringUtils.isBlank(cachedCode)) {