| | |
| | | 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 io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | 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 |
| | | @RequestMapping("ffzf/updateApp") |
| | | @RequiredArgsConstructor |
| | | @Tag(description = "ffzf/updateApp" , name = "app更新接口" ) |
| | | public class UpdateAppController{ |
| | | |
| | | private final UpdateAppService updateAppService; |
| | | private final SystemConfigProperties systemConfigProperties; |
| | | |
| | | @PostMapping("/getUpdateApp") |
| | | @Operation(summary = "获取最新app版本" , description = "获取最新app版本" ) |
| | | public Object getUpdateApp(){ |
| | | List<UpdateApp> all = updateAppService.list(); |
| | | if(all.size()==0){ |
| | |
| | | } |
| | | 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()); |
| | | } |
| | | } |
| | | |
| | | } |