|
|
|
@ -34,9 +34,6 @@ public class QiniuServiceImpl implements IQiniuService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private QiniuConfig qiniuConfig; |
|
|
|
|
|
|
|
private String token = null; |
|
|
|
private UploadManager uploadManager; |
|
|
|
private Zone zone = new Zone.Builder(Zone.autoZone()) |
|
|
|
.upHttp("http://upload.qiniup.com") |
|
|
|
.upHttps("http://upload.qiniup.com") |
|
|
|
@ -81,8 +78,6 @@ public class QiniuServiceImpl implements IQiniuService { |
|
|
|
ioe.printStackTrace(); |
|
|
|
return "error"; |
|
|
|
} |
|
|
|
//String path = qiniuService.uploadFile(file)
|
|
|
|
// System.out.print("七牛云返回的图片链接:" + path);
|
|
|
|
return url; |
|
|
|
} |
|
|
|
return "error"; |
|
|
|
@ -101,7 +96,6 @@ public class QiniuServiceImpl implements IQiniuService { |
|
|
|
String secretKey= qiniuConfig.getSecretKey(); |
|
|
|
Auth auth = Auth.create(accessKey, secretKey); |
|
|
|
String qiniuToken = "Qiniu " + auth.signRequestV2(url, method, body.getBytes(), contentType); |
|
|
|
//log.info("url={},body={},qiniuToken={}",url,body,qiniuToken);
|
|
|
|
//头部部分
|
|
|
|
StringMap header = new StringMap(); |
|
|
|
header.put("Host",host); |
|
|
|
@ -111,20 +105,8 @@ public class QiniuServiceImpl implements IQiniuService { |
|
|
|
Client client = new Client(c); |
|
|
|
try { |
|
|
|
Response response = client.post(url, body.getBytes(), header, contentType); |
|
|
|
//System.out.println(response.bodyString());
|
|
|
|
//log.info("response result={}",response.bodyString());
|
|
|
|
JSONObject checkResult = JSON.parseObject(response.bodyString()); |
|
|
|
String checkMsg = JSON.parseObject(checkResult.get("result").toString()).get("suggestion").toString(); |
|
|
|
if (checkMsg.equals("pass")){ |
|
|
|
//可以通过
|
|
|
|
} |
|
|
|
if (checkMsg.equals("review")){ |
|
|
|
//人工审核
|
|
|
|
} |
|
|
|
if (checkMsg.equals("block")){ |
|
|
|
//不可通过
|
|
|
|
} |
|
|
|
return checkMsg; |
|
|
|
return JSON.parseObject(checkResult.get("result").toString()).get("suggestion").toString(); |
|
|
|
} catch (QiniuException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
@ -182,8 +164,6 @@ public class QiniuServiceImpl implements IQiniuService { |
|
|
|
videoSuffixList.add("mp4"); |
|
|
|
videoSuffixList.add("mov"); |
|
|
|
videoSuffixList.add("wmv"); |
|
|
|
// imageSuffix.add("jpg");
|
|
|
|
// imageSuffix.add("jpg");
|
|
|
|
if (suffix != null&&imageSuffixList.contains(suffix)&&multipartFile.getSize() / 1024 < 50000&&multipartFile.getSize() / 1024 > 0) { |
|
|
|
afterCheckFiles.add(multipartFile); |
|
|
|
} |
|
|
|
|