Merge branch 'dev'

This commit is contained in:
wangliwen 2022-11-08 10:22:37 +08:00
commit ff844bc432
1 changed files with 9 additions and 1 deletions

View File

@ -6,9 +6,11 @@ import io.renren.common.utils.Result;
import io.renren.common.utils.UpdateUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -21,6 +23,8 @@ public class AdminController {
@Autowired
private UpdateUtil updateUtil;
@Value("${spring.profiles.active}")
private String active; // 现有生效
/**
* @param updateFile 更新包下载地址
@ -31,7 +35,11 @@ public class AdminController {
@ApiOperation("进行后台程序更新")
@LogOperation("进行后台程序更新")
public Result<String> update(String updateFile, String active) {
return new Result<String>().ok("");
if (StringUtils.isEmpty(active)) {
active = this.active;
}
boolean success = updateUtil.update(updateFile, active);
return new Result<String>().ok(String.valueOf(success));
}
}