Explorar el Código

优化协议取值逻辑

yjwang hace 1 semana
padre
commit
ad453a6e4e

+ 1 - 12
fs-service/src/main/java/com/fs/course/service/impl/FsCoursePlaySourceConfigServiceImpl.java

@@ -46,7 +46,7 @@ public class FsCoursePlaySourceConfigServiceImpl extends ServiceImpl<FsCoursePla
 
     @Override
     public FsCoursePlaySourceConfig selectConfigByAppId(String appId, String key) {
-        String configValue = Convert.toStr(redisCache.getCacheObject(getCacheKey(key)));
+        String configValue = Convert.toStr(redisCache.getCacheObject(key));
         if (StringUtils.isNotEmpty(configValue)) {
             return converter(configValue);
         }
@@ -61,17 +61,6 @@ public class FsCoursePlaySourceConfigServiceImpl extends ServiceImpl<FsCoursePla
         return null;
     }
 
-    /**
-     * 设置cache key
-     *
-     * @param configKey 参数键
-     * @return 缓存键key
-     */
-    private String getCacheKey(String configKey)
-    {
-        return Constants.SYS_CONFIG_KEY + configKey;
-    }
-
     private FsCoursePlaySourceConfig  converter(String value){
         if(StringUtils.isNotEmpty(value)){
             return JSON.parseObject(value,FsCoursePlaySourceConfig.class);

+ 3 - 3
fs-user-app/src/main/java/com/fs/app/controller/CommonController.java

@@ -316,11 +316,11 @@ public class CommonController {
 	@ApiOperation("获取配置")
 	public R getConfigByKey(@RequestParam(value = "key", required = false) String key,@RequestParam(value = "appId",required = false) String appId)
 	{
-		 if(StringUtils.isNotEmpty(appId) && "his.agreementConfig".equals("key")){
+		 if(StringUtils.isNotEmpty(appId) && "his.agreementConfig".equals(key)){
 			//获取APPID信息
-			key = "ProtocolConfig:"+appId;
+			String newKey = "ProtocolConfig:"+appId;
 			//获取小程序配置数据
-			FsCoursePlaySourceConfig config = fsCoursePlaySourceConfigService.selectConfigByAppId(appId , key);
+			FsCoursePlaySourceConfig config = fsCoursePlaySourceConfigService.selectConfigByAppId(appId , newKey);
 			if(config != null){
 				return R.ok().put("data",config);
 			}