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