|
|
|
@ -2,31 +2,34 @@ package cn.toesbieya.jxc.file.controller; |
|
|
|
|
|
|
|
|
|
|
|
import cn.toesbieya.jxc.common.model.vo.R; |
|
|
|
import cn.toesbieya.jxc.common.model.vo.R; |
|
|
|
import cn.toesbieya.jxc.file.service.FileService; |
|
|
|
import cn.toesbieya.jxc.file.service.FileService; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam; |
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
import java.net.URLDecoder; |
|
|
|
import java.net.URLDecoder; |
|
|
|
|
|
|
|
|
|
|
|
@Controller |
|
|
|
@RestController |
|
|
|
@RequestMapping("file") |
|
|
|
@RequestMapping("file") |
|
|
|
public class FileController { |
|
|
|
public class FileController { |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private FileService service; |
|
|
|
private FileService service; |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("delete") |
|
|
|
@GetMapping("delete") |
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
public R delete(@RequestParam String url) throws UnsupportedEncodingException { |
|
|
|
public R delete(@RequestParam String url) throws UnsupportedEncodingException { |
|
|
|
service.delete(URLDecoder.decode(url, "utf-8")); |
|
|
|
service.delete(URLDecoder.decode(url, "utf-8")); |
|
|
|
return R.success("删除成功"); |
|
|
|
return R.success("删除成功"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("deleteBatch") |
|
|
|
|
|
|
|
public R deleteBatch(@RequestBody String[] urls) { |
|
|
|
|
|
|
|
if (urls.length == 0) { |
|
|
|
|
|
|
|
return R.fail("参数错误"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
service.deleteBatch(urls); |
|
|
|
|
|
|
|
return R.success("批量删除成功"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("getToken") |
|
|
|
@GetMapping("getToken") |
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
public R getToken() { |
|
|
|
public R getToken() { |
|
|
|
return R.success(null, service.getToken()); |
|
|
|
return R.success(null, service.getToken()); |
|
|
|
} |
|
|
|
} |
|
|
|
|