ソースを参照

Merge remote-tracking branch 'origin/dev-1.2.0' into dev-1.2.0

LiRong 3 ヶ月 前
コミット
eff1d36c87

+ 19 - 0
leromro-admin/src/main/java/com/leromro/web/controller/system/SysConfigController.java

@@ -8,6 +8,7 @@ import com.leromro.common.core.page.TableDataInfo;
 import com.leromro.common.enums.BusinessType;
 import com.leromro.common.utils.poi.ExcelUtil;
 import com.leromro.system.domain.SysConfig;
+import com.leromro.system.domain.vo.VersionInfoVO;
 import com.leromro.system.service.ISysConfigService;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -136,4 +137,22 @@ public class SysConfigController extends BaseController
         return R.ok(configService.selectConfigByKey("homeRollText"));
     }
 
+    /**
+     * 通过版本号获取服务地址
+     */
+    @ApiOperation(value = "通过版本号获取服务地址")
+    @GetMapping("/serviceUrl/{version}")
+    public R<VersionInfoVO> getServiceUrl(@PathVariable String version) {
+        VersionInfoVO  versionInfoVO = new VersionInfoVO();
+        // 获取当前正式的版本号
+        String currentVersion = configService.selectConfigByKey("currentVersion");
+        versionInfoVO.setCurrentVersion(currentVersion);
+        // 如果指定版本小于等于正式版本,则默认访问正式服务,否则返回预发布服务
+        if (version.compareTo(currentVersion) <= 0) {
+            versionInfoVO.setServiceUrl(configService.selectConfigByKey("serviceUrl"));
+        }else{
+            versionInfoVO.setServiceUrl(configService.selectConfigByKey("serviceUrlPre"));
+        }
+        return R.ok(versionInfoVO);
+    }
 }

+ 1 - 1
leromro-framework/src/main/java/com/leromro/framework/config/SecurityConfig.java

@@ -112,7 +112,7 @@ public class SecurityConfig
                 permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
                 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
                 requests.antMatchers("/login","/loginWeb", "/register", "/captchaImage","/system/dict/**,","/websocket/**",
-                                "/core/users/orders/payNotify","/core/users/orders/refundNotify","/system/config/getHomeRollText").permitAll()
+                                "/core/users/orders/payNotify","/core/users/orders/refundNotify","/system/config/getHomeRollText","/system/config/serviceUrl/**").permitAll()
                     //微信小程序需要提供部分预览功能
                     .antMatchers("/core/volunteer/info/list","/core/volunteer/info/getDetails",
                                 "/web/core/slideshow/**","/core/business/management/**",

+ 15 - 0
leromro-system/src/main/java/com/leromro/system/domain/vo/VersionInfoVO.java

@@ -0,0 +1,15 @@
+package com.leromro.system.domain.vo;
+
+import lombok.Data;
+
+/**
+ * 版本信息vo
+ */
+@Data
+public class VersionInfoVO {
+    // 当前正式版本
+    private String currentVersion;
+
+    // 服务地址
+    private String serviceUrl;
+}