| | |
| | | package com.boying.controller.phone; |
| | | |
| | | import cn.hutool.core.io.IoUtil; |
| | | import com.boying.common.R; |
| | | import com.boying.common.SystemConfigProperties; |
| | | import com.boying.entity.UpdateApp; |
| | | import com.boying.service.UpdateAppService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStream; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | |
| | | public class UpdateAppController{ |
| | | |
| | | private final UpdateAppService updateAppService; |
| | | private final SystemConfigProperties systemConfigProperties; |
| | | |
| | | @PostMapping("/getUpdateApp") |
| | | public Object getUpdateApp(){ |
| | |
| | | } |
| | | return R.ok(all.get(0)); |
| | | } |
| | | @GetMapping("/getFile/{filename}") |
| | | public void getFile(@PathVariable String filename, HttpServletResponse response){ |
| | | try { |
| | | InputStream input = new FileInputStream(new File(systemConfigProperties.getUploadImgPath()+filename)); |
| | | response.setContentType("application/octet-stream; charset=UTF-8"); |
| | | IoUtil.copy(input, response.getOutputStream()); |
| | | }catch (Exception e){ |
| | | System.out.println("文件读取异常,"+e.getLocalizedMessage()); |
| | | } |
| | | } |
| | | |
| | | } |