refactor: 编辑脚本只保存本地,审批通过时才同步到七牛云
This commit is contained in:
@@ -45,6 +45,7 @@ public class AdminController {
|
||||
private final PskService pskService;
|
||||
private final ConfigService configService;
|
||||
private final CachedStorageService storageService;
|
||||
private final com.par.core.storage.LocalStorageService localStorageService;
|
||||
private final com.par.core.service.SiteService siteService;
|
||||
|
||||
/**
|
||||
@@ -264,14 +265,14 @@ public class AdminController {
|
||||
if (scriptPath == null || scriptPath.isBlank()) {
|
||||
String hash = config.getConfigHash() != null ? config.getConfigHash().substring(0, 8)
|
||||
: Long.toHexString(System.currentTimeMillis());
|
||||
scriptPath = String.format("configs/%s/%s/%s.groovy", config.getSiteId(),
|
||||
config.getStatus() == ConfigStatus.PENDING ? "pending" : "approved", hash);
|
||||
scriptPath = String.format("configs/%s/pending/%s.groovy", config.getSiteId(), hash);
|
||||
config.setScriptStoragePath(scriptPath);
|
||||
}
|
||||
storageService.store(scriptPath, script);
|
||||
// 只保存到本地,审批通过时才同步到七牛云
|
||||
localStorageService.store(scriptPath, script);
|
||||
siteConfigMapper.updateById(config);
|
||||
|
||||
log.info("Config script updated: id={}, siteId={}", configId, config.getSiteId());
|
||||
log.info("Config script saved locally: id={}, siteId={}", configId, config.getSiteId());
|
||||
return ApiResponse.success(configService.toDTO(config));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user