优化平台配置的接口
This commit is contained in:
@@ -44,7 +44,7 @@ public class PlatformConfigController {
|
||||
String res;
|
||||
try {
|
||||
String platformKey = "platform_name";
|
||||
PlatformConfig platformConfig = platformConfigService.getPlatformConfigByKey(platformKey);
|
||||
PlatformConfig platformConfig = platformConfigService.getInfoByKey(platformKey);
|
||||
res = platformConfig.getPlatformValue();
|
||||
} catch(Exception e){
|
||||
e.printStackTrace();
|
||||
@@ -64,7 +64,27 @@ public class PlatformConfigController {
|
||||
String res;
|
||||
try {
|
||||
String platformKey = "platform_url";
|
||||
PlatformConfig platformConfig = platformConfigService.getPlatformConfigByKey(platformKey);
|
||||
PlatformConfig platformConfig = platformConfigService.getInfoByKey(platformKey);
|
||||
res = platformConfig.getPlatformValue();
|
||||
} catch(Exception e){
|
||||
e.printStackTrace();
|
||||
res = "#";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取是否开启注册
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getPlatform/registerFlag")
|
||||
@ApiOperation(value = "获取是否开启注册")
|
||||
public String getPlatformRegisterFlag(HttpServletRequest request)throws Exception {
|
||||
String res;
|
||||
try {
|
||||
String platformKey = "register_flag";
|
||||
PlatformConfig platformConfig = platformConfigService.getInfoByKey(platformKey);
|
||||
res = platformConfig.getPlatformValue();
|
||||
} catch(Exception e){
|
||||
e.printStackTrace();
|
||||
@@ -100,13 +120,13 @@ public class PlatformConfigController {
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getPlatformConfigByKey")
|
||||
@GetMapping(value = "/getInfoByKey")
|
||||
@ApiOperation(value = "根据platformKey查询信息")
|
||||
public BaseResponseInfo getPlatformConfigByKey(@RequestParam("platformKey") String platformKey,
|
||||
public BaseResponseInfo getInfoByKey(@RequestParam("platformKey") String platformKey,
|
||||
HttpServletRequest request)throws Exception {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
try {
|
||||
PlatformConfig platformConfig = platformConfigService.getPlatformConfigByKey(platformKey);
|
||||
PlatformConfig platformConfig = platformConfigService.getInfoByKey(platformKey);
|
||||
res.code = 200;
|
||||
res.data = platformConfig;
|
||||
} catch(Exception e){
|
||||
|
||||
@@ -154,7 +154,7 @@ public class PlatformConfigService {
|
||||
return result;
|
||||
}
|
||||
|
||||
public PlatformConfig getPlatformConfigByKey(String platformKey)throws Exception {
|
||||
public PlatformConfig getInfoByKey(String platformKey)throws Exception {
|
||||
PlatformConfig platformConfig = new PlatformConfig();
|
||||
try{
|
||||
if(platformKey.contains("aliOss") || platformKey.contains("weixin")) {
|
||||
@@ -172,4 +172,25 @@ public class PlatformConfigService {
|
||||
}
|
||||
return platformConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据key查询平台信息-内部专用方法
|
||||
* @param platformKey
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public PlatformConfig getPlatformConfigByKey(String platformKey)throws Exception {
|
||||
PlatformConfig platformConfig = new PlatformConfig();
|
||||
try{
|
||||
PlatformConfigExample example = new PlatformConfigExample();
|
||||
example.createCriteria().andPlatformKeyEqualTo(platformKey);
|
||||
List<PlatformConfig> list=platformConfigMapper.selectByExample(example);
|
||||
if(list!=null && list.size()>0){
|
||||
platformConfig = list.get(0);
|
||||
}
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return platformConfig;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user