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);
|
}
|
|
}
|