提交 386e265d authored 作者: wangqiang's avatar wangqiang

Merge remote-tracking branch 'origin/master'

......@@ -130,7 +130,7 @@ public class ProgramController {
}
@GetMapping(value = "{type}/download_and_install")
public R<String> downloadAndInstall(@PathVariable @Pattern(regexp = "install|upgrade") String type,
public void downloadAndInstall(@PathVariable @Pattern(regexp = "install|upgrade") String type,
@RequestParam @NotNull Long id,
@RequestParam @NotBlank String url,
HttpServletResponse response) throws IOException {
......@@ -177,8 +177,7 @@ public class ProgramController {
}
}));
MAP.get(key).start();*/
return R.success(file.getPath());
DOWNLOAD_PATH_MAP.put(key, file.getPath());
}
/*@GetMapping(value = "{type}/is_installing")
......@@ -187,6 +186,25 @@ public class ProgramController {
return R.success(MAP.containsKey(type + "-" + id));
}*/
private static final Map<String, String> DOWNLOAD_PATH_MAP = new ConcurrentHashMap<>();
@GetMapping(value = "{type}/get_download_path")
public R<String> getDownloadPath(@PathVariable @Pattern(regexp = "install|upgrade") String type,
@RequestParam @NotNull Long id) {
return R.success(DOWNLOAD_PATH_MAP.get(type + "-" + id));
}
@GetMapping(value = "{type}/install_success")
public R<Void> installSuccess(@PathVariable @Pattern(regexp = "install|upgrade") String type,
@RequestParam @NotNull Long id) {
String reqUrl = gateway + StrUtil.format(type.equals("install") ? installStatusUpIssueUrl : upgradeStatusUpIssueUrl,
MacAddrUtil.get(), id);
HttpUtil.post(reqUrl, (String) null);
return R.success();
}
@GetMapping(value = "get_version")
public R<String> getVersion(@RequestParam @NotBlank String name) throws IOException {
installedProgramCache.loadProgramListJob();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论