release: 获取Env环境变量

release-2024-08-08
huangyw 4 months ago
parent eb35181869
commit 0b0291e786

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

@ -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<EnvConfig> getEnv() {
return Result.success(envConfig);
}
}

@ -6,6 +6,7 @@ import api.Result;
import api.StatusCode; import api.StatusCode;
import cn.hutool.extra.qrcode.QrCodeUtil; import cn.hutool.extra.qrcode.QrCodeUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.luoo.user.config.EnvConfig;
import com.luoo.user.dto.UserNameLoginDto; import com.luoo.user.dto.UserNameLoginDto;
import com.luoo.user.dto.request.*; import com.luoo.user.dto.request.*;
import com.luoo.user.dto.response.CountryCodeDTO; import com.luoo.user.dto.response.CountryCodeDTO;
@ -69,8 +70,8 @@ public class LoginController extends BaseController {
@Autowired @Autowired
private JwtUtil jwtUtil; private JwtUtil jwtUtil;
@Value("${download.url}") @Autowired
private String downloadUrl; private EnvConfig envConfig;
/** /**
* *
@ -445,17 +446,11 @@ public class LoginController extends BaseController {
e.printStackTrace(); e.printStackTrace();
} }
log.info(downloadUrl); log.info(envConfig.getDownloadUrl());
return Result.success(downloadUrl + "?code=" + uuid); return Result.success(envConfig.getDownloadUrl() + uuid);
}
@ApiOperation(value = "9.4.获取登录二维码前缀", notes = "获取登录二维码前缀")
@GetMapping(value = "/getDownloadUrl")
public Result<String> getDownloadUrl() {
return Result.success(downloadUrl + "?code=");
} }
@ApiOperation(value = "9.5.确认身份接口:确定身份以及判断是否二维码过期等", notes = "确认身份接口确定身份以及判断是否二维码过期等仅APP用户可用") @ApiOperation(value = "9.4.确认身份接口:确定身份以及判断是否二维码过期等", notes = "确认身份接口确定身份以及判断是否二维码过期等仅APP用户可用")
@PostMapping(value = "/scanOrConfirm") @PostMapping(value = "/scanOrConfirm")
@GlobalInterceptor(checkAppUserLogin = true) @GlobalInterceptor(checkAppUserLogin = true)
@ApiImplicitParams({ @ApiImplicitParams({

Loading…
Cancel
Save