From c79b1ebed5a42a4cbb2f824232da2a51ff22a9a1 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 04 十二月 2021 18:25:08 +0800
Subject: [PATCH] 功能完善

---
 app/src/test/java/test/ConfigTest.java |  114 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 113 insertions(+), 1 deletions(-)

diff --git a/app/src/test/java/test/ConfigTest.java b/app/src/test/java/test/ConfigTest.java
index 62d20b0..61e2cba 100644
--- a/app/src/test/java/test/ConfigTest.java
+++ b/app/src/test/java/test/ConfigTest.java
@@ -5,6 +5,7 @@
 import com.yeshi.location.app.entity.config.SystemConfig;
 import com.yeshi.location.app.entity.config.SystemConfigKey;
 import com.yeshi.location.app.service.inter.config.SystemConfigService;
+import net.sf.json.JSONObject;
 import org.junit.jupiter.api.Test;
 import org.springframework.boot.test.context.SpringBootTest;
 
@@ -69,7 +70,6 @@
         systemConfigService.save(config);
 
 
-
         config = new SystemConfig();
         config.setKey(SystemConfigKey.signKey);
         config.setName(config.getKey().getDesc());
@@ -87,4 +87,116 @@
 
     }
 
+
+    @Test
+    public void addClientConfig() {
+        SystemConfigKey[] keys = new SystemConfigKey[]{
+                SystemConfigKey.kefu,
+                SystemConfigKey.course,
+                SystemConfigKey.unRegister,
+                SystemConfigKey.privacyComplain,
+                SystemConfigKey.vipLink,
+                SystemConfigKey.sdkList,
+
+        };
+
+        for (SystemConfigKey key : keys) {
+            SystemConfig config = new SystemConfig();
+            config.setKey(key);
+            config.setName(config.getKey().getDesc());
+            config.setSystem(SystemEnum.location);
+            config.setValue("https://www.baidu.com");
+            systemConfigService.save(config);
+        }
+    }
+
+
+    private String getGDT(String pid) {
+
+        JSONObject root = new JSONObject();
+        JSONObject channel = new JSONObject();
+        channel.put("version", 1);
+        channel.put("type", "gdt");
+        channel.put("pid", pid);
+        root.put("qq", channel.toString());
+
+        return root.toString();
+
+    }
+
+    private String getCSJ(String pid) {
+
+        JSONObject root = new JSONObject();
+        JSONObject channel = new JSONObject();
+        channel.put("version", 1);
+        channel.put("type", "csj");
+        channel.put("pid", pid);
+        root.put("qq", channel.toString());
+
+        return root.toString();
+
+    }
+
+    @Test
+    public void addADPosition() {
+        SystemConfig config = new SystemConfig();
+        config.setKey(SystemConfigKey.ad_splash);
+        config.setName(config.getKey().getDesc());
+        config.setSystem(SystemEnum.location);
+        config.setValue(getGDT("5002860910157654"));
+        config.setValue(getCSJ("887634894"));
+        systemConfigService.save(config);
+
+        config = new SystemConfig();
+        config.setKey(SystemConfigKey.ad_homeInterstitial);
+        config.setName(config.getKey().getDesc());
+        config.setSystem(SystemEnum.location);
+        config.setValue(getGDT("1012267980852677"));
+        config.setValue(getCSJ("947240112"));
+        systemConfigService.save(config);
+
+
+        config = new SystemConfig();
+        config.setKey(SystemConfigKey.ad_mineExpress);
+        config.setName(config.getKey().getDesc());
+        config.setSystem(SystemEnum.location);
+        config.setValue(getGDT("8082461920451628"));
+        config.setValue(getCSJ("947239180"));
+        systemConfigService.save(config);
+
+
+        config = new SystemConfig();
+        config.setKey(SystemConfigKey.ad_searchExpress);
+        config.setName(config.getKey().getDesc());
+        config.setSystem(SystemEnum.location);
+        config.setValue(getGDT("8082461920451628"));
+        config.setValue(getCSJ("947239180"));
+        systemConfigService.save(config);
+
+
+        config = new SystemConfig();
+        config.setKey(SystemConfigKey.ad_searchResultBanner);
+        config.setName(config.getKey().getDesc());
+        config.setSystem(SystemEnum.location);
+        config.setValue(getGDT("4022361930756639"));
+        config.setValue(getCSJ("947242084"));
+        systemConfigService.save(config);
+
+        config = new SystemConfig();
+        config.setKey(SystemConfigKey.ad_travelShareInterstitial);
+        config.setName(config.getKey().getDesc());
+        config.setSystem(SystemEnum.location);
+        config.setValue(getGDT("1012267980852677"));
+        config.setValue(getCSJ("947240112"));
+        systemConfigService.save(config);
+
+        config = new SystemConfig();
+        config.setKey(SystemConfigKey.ad_vipReward);
+        config.setName(config.getKey().getDesc());
+        config.setSystem(SystemEnum.location);
+        config.setValue(getGDT("9012462980758616"));
+        config.setValue(getCSJ("947239184"));
+        systemConfigService.save(config);
+    }
+
 }

--
Gitblit v1.8.0