|
@@ -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);
|
|
|
+ }
|
|
|
}
|