Compare commits
2 Commits
1d838ec57e
...
0f3c9e78a6
| Author | SHA1 | Date | |
|---|---|---|---|
| 0f3c9e78a6 | |||
| 1051a7b84f |
@@ -25,7 +25,7 @@ public class GreenImageScan {
|
||||
com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
|
||||
.setAccessKeyId(accessKeyId)
|
||||
.setAccessKeySecret(secret);
|
||||
// 访问的域名
|
||||
// 访问的域名 - 修改为北京区域
|
||||
config.endpoint = "imageaudit.cn-shanghai.aliyuncs.com";
|
||||
|
||||
com.aliyun.imageaudit20191230.Client client = new com.aliyun.imageaudit20191230.Client(config);
|
||||
@@ -34,21 +34,21 @@ public class GreenImageScan {
|
||||
|
||||
for (String img: imageList) {
|
||||
ScanImageRequest.ScanImageRequestTask task = new ScanImageRequest.ScanImageRequestTask();
|
||||
task.setImageURL(img); // 修复:直接使用图片URL而不是转换为字符数组 task.setDataId(UUID.randomUUID().toString());
|
||||
task.setImageURL(img);
|
||||
task.setDataId(UUID.randomUUID().toString());
|
||||
task.setImageTimeMillisecond(1L);
|
||||
task.setInterval(1);
|
||||
task.setMaxFrames(1);
|
||||
taskList.add(task);
|
||||
}
|
||||
|
||||
|
||||
//场景
|
||||
List<String> sceneList = new ArrayList<>();
|
||||
// 移除了不支持的"antispam"场景,使用支持的场景
|
||||
sceneList.add("porn"); // 涉黄识别
|
||||
sceneList.add("terrorism"); // 暴恐识别
|
||||
sceneList.add("ad"); // 图片广告
|
||||
sceneList.add("live"); // 不良场景
|
||||
sceneList.add("live"); // 不不良场景
|
||||
sceneList.add("logo"); // logo识别
|
||||
|
||||
com.aliyun.imageaudit20191230.models.ScanImageRequest scanImageRequest = new com.aliyun.imageaudit20191230.models.ScanImageRequest()
|
||||
@@ -66,9 +66,6 @@ public class GreenImageScan {
|
||||
ListIterator<ScanImageResponseBody.ScanImageResponseBodyDataResultsSubResults> listIterator = subResults.listIterator();
|
||||
while (listIterator.hasNext()) {
|
||||
ScanImageResponseBody.ScanImageResponseBodyDataResultsSubResults item = listIterator.next();
|
||||
/* System.out.println("scene = [" + item.scene + "]");
|
||||
System.out.println("suggestion = [" + item.suggestion + "]");
|
||||
System.out.println("label = [" + item.label + "]");*/
|
||||
|
||||
if (!item.suggestion.equals("pass")) {
|
||||
resultMap.put("suggestion", item.suggestion);
|
||||
@@ -82,14 +79,10 @@ public class GreenImageScan {
|
||||
return resultMap;
|
||||
|
||||
} else {
|
||||
/* *
|
||||
* 表明请求整体处理失败,原因视具体的情况详细分析
|
||||
*/
|
||||
System.out.println("the whole image scan request failed. response:" + JSON.toJSONString(scanImageResponse));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
} catch (com.aliyun.tea.TeaException teaException) {
|
||||
// 获取整体报错信息
|
||||
System.out.println(com.aliyun.teautil.Common.toJSONString(teaException));
|
||||
@@ -100,9 +93,5 @@ public class GreenImageScan {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
/* Map<String, String> resultMap = new HashMap<>();
|
||||
resultMap.put("suggestion", "pass");
|
||||
return resultMap;*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,4 +6,12 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface PostMapper {
|
||||
int insert(Post post);
|
||||
|
||||
int increaseLikeCount(Long postId);
|
||||
|
||||
int selectLikeCount(Long postId);
|
||||
|
||||
int decreaseLikeCount(Long postId);
|
||||
|
||||
int deletePostById(Integer postId);
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public class PostServiceImpl implements PostService {
|
||||
}
|
||||
|
||||
Post post = new Post();
|
||||
post.setUserId(postRequestDTO.getUserId());
|
||||
post.setUserId(Long.valueOf(postRequestDTO.getUserId()));
|
||||
post.setContent(postRequestDTO.getContent());
|
||||
post.setTags(postRequestDTO.getTags());
|
||||
post.setMediaOssKeys(new ArrayList<>());
|
||||
|
||||
Reference in New Issue
Block a user