admin
2021-12-04 c79b1ebed5a42a4cbb2f824232da2a51ff22a9a1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
package test;
 
import com.yeshi.location.app.Application;
import com.yeshi.location.app.entity.SystemEnum;
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;
 
import javax.annotation.Resource;
 
/**
 * @author hxh
 * @title: ConfigTest
 * @description: TODO
 * @date 2021/11/16 14:08
 */
@SpringBootTest(classes = Application.class)
public class ConfigTest {
 
    @Resource
    private SystemConfigService systemConfigService;
 
    @Test
    public void addConfig() throws Exception {
        SystemConfig config = new SystemConfig();
        config.setKey(SystemConfigKey.defaultNickNamePrefix);
        config.setName(config.getKey().getDesc());
        config.setSystem(SystemEnum.location);
        config.setValue("定位_");
        systemConfigService.save(config);
 
        config = new SystemConfig();
        config.setKey(SystemConfigKey.defaultPortrait);
        config.setName(config.getKey().getDesc());
        config.setSystem(SystemEnum.location);
        config.setValue("https://location-1255749512.cos.ap-nanjing.myqcloud.com/resource/img/default_img.png");
        systemConfigService.save(config);
 
 
        config = new SystemConfig();
        config.setKey(SystemConfigKey.aliyunOneKeyAuthAcessKey);
        config.setName(config.getKey().getDesc());
        config.setSystem(SystemEnum.location);
        config.setValue("LTAI4FwmTxVCuzTaoZtDiV8z");
        systemConfigService.save(config);
 
        config = new SystemConfig();
        config.setKey(SystemConfigKey.aliyunOneKeyAuthAcessSecret);
        config.setName(config.getKey().getDesc());
        config.setSystem(SystemEnum.location);
        config.setValue("ixWg90QbYFKP6ae5xpAo2P1qwIyll5");
        systemConfigService.save(config);
 
        config = new SystemConfig();
        config.setKey(SystemConfigKey.tencentSMSAppId);
        config.setName(config.getKey().getDesc());
        config.setSystem(SystemEnum.location);
        config.setValue("1400598415");
        systemConfigService.save(config);
 
 
        config = new SystemConfig();
        config.setKey(SystemConfigKey.tencentSMSAppKey);
        config.setName(config.getKey().getDesc());
        config.setSystem(SystemEnum.location);
        config.setValue("1f61c060b36c5b5f2e8f5291cfdb964c");
        systemConfigService.save(config);
 
 
        config = new SystemConfig();
        config.setKey(SystemConfigKey.signKey);
        config.setName(config.getKey().getDesc());
        config.setSystem(SystemEnum.location);
        config.setValue("@#$^234AB&c&fg&.==888");
        systemConfigService.save(config);
 
 
        config = new SystemConfig();
        config.setKey(SystemConfigKey.tencentVerifySMSTemplate);
        config.setName(config.getKey().getDesc());
        config.setSystem(SystemEnum.location);
        config.setValue("【智在千里】验证码:{验证码},2分钟内有效。为了保护您的账号安全,验证短信请勿转发他人。");
        systemConfigService.save(config);
 
    }
 
 
    @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);
    }
 
}