优化平台配置的接口
This commit is contained in:
@@ -44,7 +44,7 @@ public class PlatformConfigController {
|
|||||||
String res;
|
String res;
|
||||||
try {
|
try {
|
||||||
String platformKey = "platform_name";
|
String platformKey = "platform_name";
|
||||||
PlatformConfig platformConfig = platformConfigService.getPlatformConfigByKey(platformKey);
|
PlatformConfig platformConfig = platformConfigService.getInfoByKey(platformKey);
|
||||||
res = platformConfig.getPlatformValue();
|
res = platformConfig.getPlatformValue();
|
||||||
} catch(Exception e){
|
} catch(Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -64,7 +64,27 @@ public class PlatformConfigController {
|
|||||||
String res;
|
String res;
|
||||||
try {
|
try {
|
||||||
String platformKey = "platform_url";
|
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();
|
res = platformConfig.getPlatformValue();
|
||||||
} catch(Exception e){
|
} catch(Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -100,13 +120,13 @@ public class PlatformConfigController {
|
|||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/getPlatformConfigByKey")
|
@GetMapping(value = "/getInfoByKey")
|
||||||
@ApiOperation(value = "根据platformKey查询信息")
|
@ApiOperation(value = "根据platformKey查询信息")
|
||||||
public BaseResponseInfo getPlatformConfigByKey(@RequestParam("platformKey") String platformKey,
|
public BaseResponseInfo getInfoByKey(@RequestParam("platformKey") String platformKey,
|
||||||
HttpServletRequest request)throws Exception {
|
HttpServletRequest request)throws Exception {
|
||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
try {
|
try {
|
||||||
PlatformConfig platformConfig = platformConfigService.getPlatformConfigByKey(platformKey);
|
PlatformConfig platformConfig = platformConfigService.getInfoByKey(platformKey);
|
||||||
res.code = 200;
|
res.code = 200;
|
||||||
res.data = platformConfig;
|
res.data = platformConfig;
|
||||||
} catch(Exception e){
|
} catch(Exception e){
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ public class PlatformConfigService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlatformConfig getPlatformConfigByKey(String platformKey)throws Exception {
|
public PlatformConfig getInfoByKey(String platformKey)throws Exception {
|
||||||
PlatformConfig platformConfig = new PlatformConfig();
|
PlatformConfig platformConfig = new PlatformConfig();
|
||||||
try{
|
try{
|
||||||
if(platformKey.contains("aliOss") || platformKey.contains("weixin")) {
|
if(platformKey.contains("aliOss") || platformKey.contains("weixin")) {
|
||||||
@@ -172,4 +172,25 @@ public class PlatformConfigService {
|
|||||||
}
|
}
|
||||||
return platformConfig;
|
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