当前位置:网站首页>Wechat picture identification
Wechat picture identification
2022-07-29 04:53:00 【BIG_ PEI】
for (String url : worksRelease.getWorksImg()) {
try {
// Picture verification
WxCheckDomain wxCheckDomain = weixinService.mediaCheckAsync(UrlToMultipartFile.urlToMultipartFile(url));
if (wxCheckDomain.getErrCode()!=0) {
throw new EnException(ResultCode.PARAM_ERROR.getCode(), " The content contains illegal content ");
}
} catch (Exception e) {
throw new EduServiceException(e.getMessage());
} }
/**
* Verify picture
*
* @param multipartFile
*/
public WxCheckDomain mediaCheckAsync(MultipartFile multipartFile) {
WxCheckDomain wxCheckDomain = new WxCheckDomain();
try {
String accToken = getWxxcxAccToken();
Integer code = reCheckPic(multipartFile, accToken);
System.err.println(code);
if (code != 0) {
wxCheckDomain.setErrCode(code);
throw new EmptyException(" The content contains illegal content ");
}
wxCheckDomain.setErrCode(code);
} catch (Exception e) {
e.printStackTrace();
}
return wxCheckDomain;
} /**
* Get wechat applet accToken
*
* @return
*/
public String getWxxcxAccToken() {
String accToken = "";
try {
//redis obtain token
if (redisClient.get(artwork_WXXCX_ACCTOKEN) == null) {
Call<Map<String, Object>> call = wxxcxEndPoint.cBToken("client_credential", wxxcxConfig.getAppId(), wxxcxConfig.getSecret());
Map<String, Object> map = call.execute().body();
accToken = (String) map.get("access_token");
redisClient.set(artwork_WXXCX_ACCTOKEN, accToken);
redisClient.expire(artwork_WXXCX_ACCTOKEN, 7200);
System.err.println(accToken);
} else {
accToken = redisClient.get(artwork_WXXCX_ACCTOKEN);
System.err.println(accToken);
}
} catch (Exception e) {
e.printStackTrace();
}
return accToken;
}边栏推荐
- 荣耀2023内推,内推码ambubk
- office2010每次打开都要配置进度怎么解决?
- Delete blank pages in word documents
- IOS interview preparation - Online
- Stack and queue and priority queue (large heap and small heap) simulation implementation and explanation of imitation function
- 正确的用户拖拽方式
- Conv2d of torch
- Mujoco and mujoco_ Install libxcursor.so 1:NO such dictionary
- mujoco和mujoco_py安装以及解决libXcursor.so.1:NO such dictionary
- 盒子水平垂直居中布局(总结)
猜你喜欢

Several simple and difficult OJ problems with sequential force deduction

un7.28:redis客户端常用命令。

安装spinning up教程里与mujoco对应的gym,报错mjpro150

GCC Basics

UE 在场景或UMG中播放视频

ios面试准备 - 网络篇

五个关联分析,领略数据分析师一大重要必会处理技能

电脑无法打开excel表格怎么办?excel打不开的解决方法

After the spinning up installation is completed, use the tutorial to test whether it is successful. There are library "Glu" not found and 'from pyglet.gl import * error solutions

在线教育的推荐系统
随机推荐
Recommendation system of online education
Glory 2023 push, push code ambubk
Un7.28: common commands of redis client.
Implementation of img responsive pictures (including the usage of srcset attribute and sizes attribute, and detailed explanation of device pixel ratio)
EMI interference troubleshooting with near-field probe and current probe
Mysql:the user specified as a definer ('root '@'%) does not exist
Climbing the pit of traffic flow prediction (II): the simplest LSTM predicts traffic flow using tensorflow2
IOS interview preparation - IOS
Word如何查看文档修改痕迹?Word查看文档修改痕迹的方法
C语言之基础语法
A little knowledge about management
[c language] use the reverse order output of the linked list (bidirectional linked list)
Conv1d of torch
Excel怎么筛选出自己想要的内容?excel表格筛选内容教程
MySQL regularly calls preset functions to complete data update
spinning up安装完使用教程测试是否成功,出现Library“GLU“ not found和‘from pyglet.gl import *错误解决办法
LeetCode(剑指 Offer)- 53 - I. 在排序数组中查找数字 I
pulsar起client客户端时(client,producer,consumer)各个配置
Review key points and data sorting of information metrology in the second semester of 2022 (teacher zhaorongying of Wuhan University)
Basic grammar of C language