七牛云配置修改
This commit is contained in:
parent
22e2abc461
commit
60682813f7
|
|
@ -28,6 +28,7 @@ public class QiniuController {
|
|||
* 七牛云上传(单个)
|
||||
*/
|
||||
@PostMapping(value = "/upload")
|
||||
@ResponseBody
|
||||
public AjaxResult uploadFile(@RequestParam(value = "uploadFile", required = false) MultipartFile file) {
|
||||
try {
|
||||
// 上传后返回的文件路径
|
||||
|
|
|
|||
|
|
@ -11,19 +11,20 @@ import com.qiniu.storage.Region;
|
|||
import com.qiniu.storage.UploadManager;
|
||||
import com.qiniu.storage.model.DefaultPutRet;
|
||||
import com.qiniu.util.Auth;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
public class QiniuUtils {
|
||||
|
||||
public static String getUpToken() {
|
||||
Auth auth = Auth.create(QiniuConfig.getAccessKey(), QiniuConfig.getSecretKey());
|
||||
return auth.uploadToken(QiniuConfig.getBucketName());
|
||||
Auth auth = Auth.create("QTNOppkvtufxTxLjt1V7YZwvzV2Rc6WLD5yXLBVY", "V8SM9nkbO-dft4JmG7UaCH6RYxXdqzrvQ0zWO2W3");
|
||||
return auth.uploadToken("gqz");
|
||||
}
|
||||
|
||||
public static String upload(byte[] uploadBytes) throws QiniuException {
|
||||
|
||||
String key = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
|
||||
Configuration cfg = new Configuration(Region.region0());//设置华南的服务器
|
||||
Configuration cfg = new Configuration(Region.region2());//设置华南的服务器
|
||||
UploadManager uploadManager = new UploadManager(cfg);
|
||||
|
||||
String upToken = getUpToken();
|
||||
|
|
@ -31,7 +32,7 @@ public class QiniuUtils {
|
|||
//解析上传成功的结果
|
||||
DefaultPutRet putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class);
|
||||
|
||||
return QiniuConfig.getMediaUrl() + putRet.key;
|
||||
return "http://gqz.opsoul.com/" + putRet.key;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -280,6 +280,7 @@ public class ShiroConfig
|
|||
filterChainDefinitionMap.put("/pay/**", "anon");
|
||||
filterChainDefinitionMap.put("/order/**", "anon");
|
||||
filterChainDefinitionMap.put("/goods/**", "anon");
|
||||
filterChainDefinitionMap.put("/tool/**", "anon");
|
||||
filterChainDefinitionMap.put("/adapay/**", "anon");
|
||||
filterChainDefinitionMap.put("/MP_verify_bRFuvYpyQ4WLr0on.txt", "anon");
|
||||
// 对静态资源设置匿名访问
|
||||
|
|
|
|||
Loading…
Reference in New Issue