Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-11-09 16:39:37 +08:00
commit 1e07f6ac86
1 changed files with 22 additions and 14 deletions

View File

@ -13,16 +13,10 @@ import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Api(tags = "管理员后台") @Api(tags = "管理员后台")
@ -37,16 +31,30 @@ public class AdminController {
private String active; // 现有生效 private String active; // 现有生效
/** // /**
* @param updateFile 更新包下载地址 // * @param updateFile 更新包下载地址
* @param active 重启完成后的配置环境 // * @param active 重启完成后的配置环境
* @return // * @return
*/ // */
// @PostMapping(value = "/update")
// public Result<String> update(String updateFile, String active) {
// if (StringUtils.isEmpty(active)) {
// active = this.active;
// }
// boolean success = updateUtil.update(updateFile, active);
// return new Result<String>().ok(String.valueOf(success));
// }
@PostMapping(value = "/update") @PostMapping(value = "/update")
public Result<String> update(String updateFile, String active) { public Result<String> update(@RequestBody Map<String, String> params) {
String updateFile = params.containsKey("updateFile") ? params.get("String updateFile") : null;
String active = params.containsKey("active") ? params.get("active") : null;
if (StringUtils.isEmpty(active)) { if (StringUtils.isEmpty(active)) {
active = this.active; active = this.active;
} }
if (StringUtils.isEmpty(updateFile)) {
return new Result<String>().ok(String.valueOf(false));
}
boolean success = updateUtil.update(updateFile, active); boolean success = updateUtil.update(updateFile, active);
return new Result<String>().ok(String.valueOf(success)); return new Result<String>().ok(String.valueOf(success));
} }