Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
4241daaf
Commit
4241daaf
authored
Jan 21, 2025
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微信文字内容安全识别
parent
c4e34921
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
4 deletions
+47
-4
ch-core/src/main/java/com/wwdz/ch/core/api/qiandao/QdWxAppletApi.java
...main/java/com/wwdz/ch/core/api/qiandao/QdWxAppletApi.java
+20
-0
ch-core/src/main/java/com/wwdz/ch/core/entity/WxCheckMediaRequestDto.java
.../java/com/wwdz/ch/core/entity/WxCheckMediaRequestDto.java
+5
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/qiandao/QdSignInTaskServiceImpl.java
.../com/wwdz/ch/wx/impl/qiandao/QdSignInTaskServiceImpl.java
+16
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/qiandao/QdUserSignInServiceImpl.java
.../com/wwdz/ch/wx/impl/qiandao/QdUserSignInServiceImpl.java
+6
-4
No files found.
ch-core/src/main/java/com/wwdz/ch/core/api/qiandao/QdWxAppletApi.java
View file @
4241daaf
...
@@ -46,6 +46,9 @@ public class QdWxAppletApi {
...
@@ -46,6 +46,9 @@ public class QdWxAppletApi {
// 微信小程序音视频内容安全识别地址
// 微信小程序音视频内容安全识别地址
private
static
final
String
MEDIA_CHECK_URL
=
"https://api.weixin.qq.com/wxa/media_check_async?access_token=%s"
;
private
static
final
String
MEDIA_CHECK_URL
=
"https://api.weixin.qq.com/wxa/media_check_async?access_token=%s"
;
// 微信小程序文字内容安全识别地址
private
static
final
String
WORD_CHECK_URL
=
"https://api.weixin.qq.com/wxa/msg_sec_check?access_token=%s"
;
//获取urllink
//获取urllink
private
static
final
String
URL_LINK
=
"https://api.weixin.qq.com/wxa/generate_urllink?access_token=%s"
;
private
static
final
String
URL_LINK
=
"https://api.weixin.qq.com/wxa/generate_urllink?access_token=%s"
;
...
@@ -81,6 +84,23 @@ public class QdWxAppletApi {
...
@@ -81,6 +84,23 @@ public class QdWxAppletApi {
}
}
public
String
checkWord
(
WxCheckMediaRequestDto
dto
)
{
String
accessToken
=
qdWxLoginManager
.
getAccessToken
();
String
url
=
String
.
format
(
WORD_CHECK_URL
,
accessToken
);
OkHttpUtil
okHttpUtil
=
OkHttpUtil
.
builder
().
url
(
url
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"content"
,
dto
.
getWordStr
());
map
.
put
(
"version"
,
2
);
map
.
put
(
"scene"
,
4
);
map
.
put
(
"openid"
,
dto
.
getWxOpenId
());
okHttpUtil
.
addParams
(
map
);
okHttpUtil
.
post
(
true
);
String
responseStr
=
okHttpUtil
.
async
();
logger
.
info
(
"[checkContent] response :{}"
,
responseStr
);
return
responseStr
;
}
public
String
getUrlLink
(
String
redirectUrl
,
String
query
)
{
public
String
getUrlLink
(
String
redirectUrl
,
String
query
)
{
String
urlLink
=
""
;
String
urlLink
=
""
;
...
...
ch-core/src/main/java/com/wwdz/ch/core/entity/WxCheckMediaRequestDto.java
View file @
4241daaf
...
@@ -13,4 +13,9 @@ public class WxCheckMediaRequestDto implements Entity {
...
@@ -13,4 +13,9 @@ public class WxCheckMediaRequestDto implements Entity {
private
Integer
mediaType
;
private
Integer
mediaType
;
private
String
mediaUrl
;
private
String
mediaUrl
;
/**
* 文字内容
*/
private
String
wordStr
;
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/qiandao/QdSignInTaskServiceImpl.java
View file @
4241daaf
package
com.wwdz.ch.wx.impl.qiandao
;
package
com.wwdz.ch.wx.impl.qiandao
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.wwdz.ch.core.api.qiandao.QdWxAppletApi
;
import
com.wwdz.ch.core.consts.CommConsts
;
import
com.wwdz.ch.core.consts.CommConsts
;
import
com.wwdz.ch.core.consts.qiandao.SignInTaskEnum
;
import
com.wwdz.ch.core.consts.qiandao.SignInTaskEnum
;
import
com.wwdz.ch.core.entity.WxCheckMediaRequestDto
;
import
com.wwdz.ch.core.type.PageSearchResult
;
import
com.wwdz.ch.core.type.PageSearchResult
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.dao.qiandao.QdUserDao
;
import
com.wwdz.ch.db.dao.qiandao.QdUserDao
;
...
@@ -22,6 +24,8 @@ import org.slf4j.Logger;
...
@@ -22,6 +24,8 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
...
@@ -52,9 +56,21 @@ public class QdSignInTaskServiceImpl implements QdSignInTaskService {
...
@@ -52,9 +56,21 @@ public class QdSignInTaskServiceImpl implements QdSignInTaskService {
@Autowired
@Autowired
QdUserDao
qdUserDao
;
QdUserDao
qdUserDao
;
@Autowired
QdWxAppletApi
qdWxAppletApi
;
@Override
@Override
public
Result
add
(
SignInTaskRequestDto
dto
)
{
public
Result
add
(
SignInTaskRequestDto
dto
)
{
try
{
try
{
WxCheckMediaRequestDto
wxCheckMediaRequestDto
=
new
WxCheckMediaRequestDto
();
//查询用户openid
QdUser
user
=
qdUserDao
.
queryById
(
dto
.
getCreatorId
());
wxCheckMediaRequestDto
.
setWxOpenId
(
user
.
getWxOpenid
());
logger
.
info
(
"=========== 微信内容安全识别接口调用成功 ==========="
);
wxCheckMediaRequestDto
.
setWordStr
(
dto
.
getName
());
qdWxAppletApi
.
checkWord
(
wxCheckMediaRequestDto
);
Date
now
=
new
Date
();
Date
now
=
new
Date
();
SignInTask
signInTask
=
new
SignInTask
();
SignInTask
signInTask
=
new
SignInTask
();
EntityMapper
.
copyAttribute
(
dto
,
signInTask
);
EntityMapper
.
copyAttribute
(
dto
,
signInTask
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/qiandao/QdUserSignInServiceImpl.java
View file @
4241daaf
...
@@ -136,17 +136,19 @@ public class QdUserSignInServiceImpl implements QdUserSignInService {
...
@@ -136,17 +136,19 @@ public class QdUserSignInServiceImpl implements QdUserSignInService {
return
Result
.
failed
(
"非打卡时段"
);
return
Result
.
failed
(
"非打卡时段"
);
}
}
}
}
if
(!
CollectionUtils
.
isEmpty
(
dto
.
getImages
()))
{
//微信音频内容安全识别
WxCheckMediaRequestDto
wxCheckMediaRequestDto
=
new
WxCheckMediaRequestDto
();
WxCheckMediaRequestDto
wxCheckMediaRequestDto
=
new
WxCheckMediaRequestDto
();
wxCheckMediaRequestDto
.
setMediaType
(
2
);
wxCheckMediaRequestDto
.
setMediaUrl
(
dto
.
getImages
().
get
(
0
));
//查询用户openid
//查询用户openid
QdUser
user
=
qdUserDao
.
queryById
(
dto
.
getUserId
());
QdUser
user
=
qdUserDao
.
queryById
(
dto
.
getUserId
());
wxCheckMediaRequestDto
.
setWxOpenId
(
user
.
getWxOpenid
());
wxCheckMediaRequestDto
.
setWxOpenId
(
user
.
getWxOpenid
());
if
(!
CollectionUtils
.
isEmpty
(
dto
.
getImages
()))
{
//微信音频内容安全识别
wxCheckMediaRequestDto
.
setMediaType
(
2
);
wxCheckMediaRequestDto
.
setMediaUrl
(
dto
.
getImages
().
get
(
0
));
qdWxAppletApi
.
checkMedia
(
wxCheckMediaRequestDto
);
qdWxAppletApi
.
checkMedia
(
wxCheckMediaRequestDto
);
logger
.
info
(
"=========== 微信音频内容安全识别接口调用成功 ==========="
);
logger
.
info
(
"=========== 微信音频内容安全识别接口调用成功 ==========="
);
}
}
wxCheckMediaRequestDto
.
setWordStr
(
dto
.
getContent
());
qdWxAppletApi
.
checkWord
(
wxCheckMediaRequestDto
);
//签到记录id
//签到记录id
Long
recordId
=
null
;
Long
recordId
=
null
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment