下载文件
This commit is contained in:
@ -94,9 +94,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
"/**/*.css",
|
||||
"/**/*.js"
|
||||
).permitAll()
|
||||
.antMatchers("/profile/**").anonymous()
|
||||
.antMatchers("/common/download**").anonymous()
|
||||
.antMatchers("/common/download/resource**").anonymous()
|
||||
// .antMatchers("/profile/**").anonymous()
|
||||
// .antMatchers("/common/download**").anonymous()
|
||||
// .antMatchers("/common/download/resource**").anonymous()
|
||||
.antMatchers("/swagger-ui.html").anonymous()
|
||||
.antMatchers("/swagger-resources/**").anonymous()
|
||||
.antMatchers("/webjars/**").anonymous()
|
||||
|
@ -140,6 +140,10 @@ public class CommonController {
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
*获取七牛资源地址
|
||||
*@param URL 上传的资源名称
|
||||
*/
|
||||
public String privateDownloadUrl(String URL) {
|
||||
|
||||
Auth auth = Auth.create(constantQiniu.getAccessKey(), constantQiniu.getSecretKey());
|
||||
@ -156,8 +160,10 @@ public class CommonController {
|
||||
public void resourceDownload(String name, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
// 本地资源路径
|
||||
String localPath = RuoYiConfig.getProfile();
|
||||
// System.out.println("localPath:"+localPath);
|
||||
// 数据库资源地址
|
||||
String downloadPath = localPath + StringUtils.substringAfter(name, Constants.RESOURCE_PREFIX);
|
||||
// System.out.println("downloadPath:"+downloadPath);
|
||||
// 下载名称
|
||||
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
|
Reference in New Issue
Block a user