From 56481656c7de11cdca69c1a7dd69db176ffd9ecd Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 08 五月 2021 12:49:30 +0800
Subject: [PATCH] 华为屏蔽金币任务中的看海量视频,新增广告平台概率控制

---
 src/main/java/com/yeshi/buwan/service/imp/system/SystemConfigServiceImpl.java |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/yeshi/buwan/service/imp/system/SystemConfigServiceImpl.java b/src/main/java/com/yeshi/buwan/service/imp/system/SystemConfigServiceImpl.java
index 3d15e00..6758943 100644
--- a/src/main/java/com/yeshi/buwan/service/imp/system/SystemConfigServiceImpl.java
+++ b/src/main/java/com/yeshi/buwan/service/imp/system/SystemConfigServiceImpl.java
@@ -7,6 +7,7 @@
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.Date;
 
 @Service
 public class SystemConfigServiceImpl implements SystemConfigService {
@@ -25,4 +26,24 @@
     public SystemConfig getConfigByKeyCache(String key) {
         return getConfigByKey(key);
     }
+
+    @Cacheable(value = "configCache", key = "'system-getConfigValueByKey'+'-'+#key")
+    @Override
+    public String getConfigValueByKeyCache(String key) {
+        SystemConfig config = getConfigByKeyCache(key);
+        if (config == null)
+            return null;
+        return config.getValue();
+    }
+
+    @Override
+    public void setValue(String key, String value) {
+        SystemConfig config = getConfigByKeyCache(key);
+        if (config == null)
+            return;
+        config.setValue(value);
+        config.setUpdateTime(new Date());
+        systemConfigDao.save(config);
+
+    }
 }

--
Gitblit v1.8.0