PC 最新版本下载链接
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbVersion;
|
||||
import com.chaozhanggui.system.cashierservice.service.LoginService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author yijiegong
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/version")
|
||||
public class VersionController {
|
||||
|
||||
@Autowired
|
||||
LoginService loginService;
|
||||
|
||||
@GetMapping("pcDownload")
|
||||
public ResponseEntity<Void> pcDownload(HttpServletRequest request, HttpServletResponse response) {
|
||||
TbVersion pcVersion = loginService.getCurrentPcVersion();
|
||||
|
||||
if (pcVersion == null) {
|
||||
throw new RuntimeException("未找到PC版本信息");
|
||||
}
|
||||
|
||||
// 重定向到下载地址
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setLocation(java.net.URI.create(pcVersion.getUrl()));
|
||||
return new ResponseEntity<>(headers, HttpStatus.FOUND);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user