七牛云服务器删除图片代码
/**
-
Created by tsy on 2019/5/16
-
七牛云上传图片
/
@RestController
@RequestMapping("/qi")
@CrossOrigin(methods = { RequestMethod.GET, RequestMethod.POST,RequestMethod.PUT,RequestMethod.DELETE }, origins = "")
public class QiniuController {
@Autowired
private QiniuService qiniuService;@RequestMapping (value = “/delImage”, method = RequestMethod.POST)
public BaseResult delImage(@RequestParam(“imagePath”) String imagePath){String[] path = imagePath.split("/"); String key = path[3]; try{ qiniuService.delImage(key,"engine"); }catch (Exception e){ e.printStackTrace(); return new BaseResult("500","网络异常",null); } return new BaseResult("200","取消上传图片",null);
}
}
/