From 0b0291e7864c2b303cf6f114dd0e62765dd81fc4 Mon Sep 17 00:00:00 2001 From: huangyw <1207046171@qq.com> Date: Thu, 8 Aug 2024 08:47:46 +0800 Subject: [PATCH] =?UTF-8?q?release:=20=E8=8E=B7=E5=8F=96Env=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/luoo/user/config/EnvConfig.java | 26 ++++++++++++++ .../luoo/user/controller/EnvController.java | 36 +++++++++++++++++++ .../luoo/user/controller/LoginController.java | 17 ++++----- 3 files changed, 68 insertions(+), 11 deletions(-) create mode 100644 luoo_user/src/main/java/com/luoo/user/config/EnvConfig.java create mode 100644 luoo_user/src/main/java/com/luoo/user/controller/EnvController.java diff --git a/luoo_user/src/main/java/com/luoo/user/config/EnvConfig.java b/luoo_user/src/main/java/com/luoo/user/config/EnvConfig.java new file mode 100644 index 0000000..1431a4e --- /dev/null +++ b/luoo_user/src/main/java/com/luoo/user/config/EnvConfig.java @@ -0,0 +1,26 @@ +package com.luoo.user.config; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * @program: luoo_parent + * @description: 参数配置 + * @author: yawei.huang + * @create: 2024-08-08 08:37 + **/ +@Getter +@Setter +@Component +@ConfigurationProperties(prefix = "env") +public class EnvConfig { + /** + * 下载地址 + */ + @ApiModelProperty(value = "下载地址") + private String downloadUrl; + +} diff --git a/luoo_user/src/main/java/com/luoo/user/controller/EnvController.java b/luoo_user/src/main/java/com/luoo/user/controller/EnvController.java new file mode 100644 index 0000000..8e33e0d --- /dev/null +++ b/luoo_user/src/main/java/com/luoo/user/controller/EnvController.java @@ -0,0 +1,36 @@ +package com.luoo.user.controller; + +import annotation.GlobalInterceptor; +import api.Result; +import com.luoo.user.config.EnvConfig; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @program: luoo_parent + * @description: 环境变量 + * @author: yawei.huang + * @create: 2024-08-08 08:38 + **/ +@RestController +@CrossOrigin +@Slf4j +@RequestMapping("/env") +@Api(tags = "环境变量") +public class EnvController { + + @Autowired + private EnvConfig envConfig; + + @RequestMapping("/getEnv") + @ApiOperation(value = "获取环境变量", notes = "获取环境变量,仅限app用户") + @GlobalInterceptor(checkAppUserLogin = true) + public Result getEnv() { + return Result.success(envConfig); + } +} diff --git a/luoo_user/src/main/java/com/luoo/user/controller/LoginController.java b/luoo_user/src/main/java/com/luoo/user/controller/LoginController.java index 8355de1..e8079be 100644 --- a/luoo_user/src/main/java/com/luoo/user/controller/LoginController.java +++ b/luoo_user/src/main/java/com/luoo/user/controller/LoginController.java @@ -6,6 +6,7 @@ import api.Result; import api.StatusCode; import cn.hutool.extra.qrcode.QrCodeUtil; import com.alibaba.fastjson.JSONObject; +import com.luoo.user.config.EnvConfig; import com.luoo.user.dto.UserNameLoginDto; import com.luoo.user.dto.request.*; import com.luoo.user.dto.response.CountryCodeDTO; @@ -69,8 +70,8 @@ public class LoginController extends BaseController { @Autowired private JwtUtil jwtUtil; - @Value("${download.url}") - private String downloadUrl; + @Autowired + private EnvConfig envConfig; /** * 更新好友粉丝数和用户关注数 @@ -445,17 +446,11 @@ public class LoginController extends BaseController { e.printStackTrace(); } - log.info(downloadUrl); - return Result.success(downloadUrl + "?code=" + uuid); - } - - @ApiOperation(value = "9.4.获取登录二维码前缀", notes = "获取登录二维码前缀") - @GetMapping(value = "/getDownloadUrl") - public Result getDownloadUrl() { - return Result.success(downloadUrl + "?code="); + log.info(envConfig.getDownloadUrl()); + return Result.success(envConfig.getDownloadUrl() + uuid); } - @ApiOperation(value = "9.5.确认身份接口:确定身份以及判断是否二维码过期等", notes = "确认身份接口:确定身份以及判断是否二维码过期等,仅APP用户可用") + @ApiOperation(value = "9.4.确认身份接口:确定身份以及判断是否二维码过期等", notes = "确认身份接口:确定身份以及判断是否二维码过期等,仅APP用户可用") @PostMapping(value = "/scanOrConfirm") @GlobalInterceptor(checkAppUserLogin = true) @ApiImplicitParams({