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