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
c0676efd
Commit
c0676efd
authored
Jan 21, 2025
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微信文字内容安全识别22
parent
4241daaf
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
21 deletions
+43
-21
ch-core/src/main/java/com/wwdz/ch/core/api/qiandao/QdWxAppletApi.java
...main/java/com/wwdz/ch/core/api/qiandao/QdWxAppletApi.java
+23
-14
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/qiandao/QdUserServiceImpl.java
...n/java/com/wwdz/ch/wx/impl/qiandao/QdUserServiceImpl.java
+6
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/qiandao/QdUserSignInServiceImpl.java
.../com/wwdz/ch/wx/impl/qiandao/QdUserSignInServiceImpl.java
+14
-2
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/qiandao/QdUserSignInController.java
...va/com/wwdz/ch/wx/web/qiandao/QdUserSignInController.java
+0
-4
No files found.
ch-core/src/main/java/com/wwdz/ch/core/api/qiandao/QdWxAppletApi.java
View file @
c0676efd
...
@@ -84,20 +84,29 @@ public class QdWxAppletApi {
...
@@ -84,20 +84,29 @@ public class QdWxAppletApi {
}
}
public
String
checkWord
(
WxCheckMediaRequestDto
dto
)
{
public
boolean
checkWord
(
WxCheckMediaRequestDto
dto
)
{
String
accessToken
=
qdWxLoginManager
.
getAccessToken
();
try
{
String
url
=
String
.
format
(
WORD_CHECK_URL
,
accessToken
);
String
accessToken
=
qdWxLoginManager
.
getAccessToken
();
OkHttpUtil
okHttpUtil
=
OkHttpUtil
.
builder
().
url
(
url
);
String
url
=
String
.
format
(
WORD_CHECK_URL
,
accessToken
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
OkHttpUtil
okHttpUtil
=
OkHttpUtil
.
builder
().
url
(
url
);
map
.
put
(
"content"
,
dto
.
getWordStr
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"version"
,
2
);
map
.
put
(
"content"
,
dto
.
getWordStr
());
map
.
put
(
"scene"
,
4
);
map
.
put
(
"version"
,
2
);
map
.
put
(
"openid"
,
dto
.
getWxOpenId
());
map
.
put
(
"scene"
,
4
);
okHttpUtil
.
addParams
(
map
);
map
.
put
(
"openid"
,
dto
.
getWxOpenId
());
okHttpUtil
.
post
(
true
);
okHttpUtil
.
addParams
(
map
);
String
responseStr
=
okHttpUtil
.
async
();
okHttpUtil
.
post
(
true
);
logger
.
info
(
"[checkContent] response :{}"
,
responseStr
);
String
responseStr
=
okHttpUtil
.
async
();
return
responseStr
;
logger
.
info
(
"[checkContent] response :{}"
,
responseStr
);
String
result
=
JsonUtils
.
getValueByPath
(
responseStr
,
"result/suggest"
);
if
(!
"pass"
.
equals
(
result
))
{
return
false
;
}
return
true
;
}
catch
(
Exception
e
)
{
logger
.
error
(
"checkContent error : {}"
,
e
);
}
return
false
;
}
}
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/qiandao/QdUserServiceImpl.java
View file @
c0676efd
...
@@ -290,7 +290,12 @@ public class QdUserServiceImpl implements QdUserService {
...
@@ -290,7 +290,12 @@ public class QdUserServiceImpl implements QdUserService {
wxCheckMediaRequestDto
.
setMediaUrl
(
dto
.
getAvatar
());
wxCheckMediaRequestDto
.
setMediaUrl
(
dto
.
getAvatar
());
wxCheckMediaRequestDto
.
setWxOpenId
(
user
.
getWxOpenid
());
wxCheckMediaRequestDto
.
setWxOpenId
(
user
.
getWxOpenid
());
qdWxAppletApi
.
checkMedia
(
wxCheckMediaRequestDto
);
qdWxAppletApi
.
checkMedia
(
wxCheckMediaRequestDto
);
logger
.
info
(
"=========== 微信音频内容安全识别接口调用成功 ==========="
);
logger
.
info
(
"=========== 微信图片内容安全识别接口调用成功 ==========="
);
}
String
key
=
dto
.
getUserId
()
+
"_updateAvatar"
;
if
(!
redisUtils
.
hasKey
(
key
))
{
redisUtils
.
set
(
key
,
key
,
30
);
return
Result
.
failed
(
"头像安全检测有风险,请更换"
);
}
}
user
.
setAvatar
(
dto
.
getAvatar
());
user
.
setAvatar
(
dto
.
getAvatar
());
qdUserDao
.
updateById
(
user
);
qdUserDao
.
updateById
(
user
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/qiandao/QdUserSignInServiceImpl.java
View file @
c0676efd
...
@@ -10,6 +10,7 @@ import com.wwdz.ch.core.consts.qiandao.SignInTaskEnum;
...
@@ -10,6 +10,7 @@ import com.wwdz.ch.core.consts.qiandao.SignInTaskEnum;
import
com.wwdz.ch.core.entity.WxCheckMediaRequestDto
;
import
com.wwdz.ch.core.entity.WxCheckMediaRequestDto
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.util.IdUtils
;
import
com.wwdz.ch.core.util.IdUtils
;
import
com.wwdz.ch.core.util.RedisUtils
;
import
com.wwdz.ch.db.dao.distribution.DistributionOrderDao
;
import
com.wwdz.ch.db.dao.distribution.DistributionOrderDao
;
import
com.wwdz.ch.db.dao.qiandao.*
;
import
com.wwdz.ch.db.dao.qiandao.*
;
import
com.wwdz.ch.db.domain.User
;
import
com.wwdz.ch.db.domain.User
;
...
@@ -65,6 +66,8 @@ public class QdUserSignInServiceImpl implements QdUserSignInService {
...
@@ -65,6 +66,8 @@ public class QdUserSignInServiceImpl implements QdUserSignInService {
@Autowired
@Autowired
QdWxAppletApi
qdWxAppletApi
;
QdWxAppletApi
qdWxAppletApi
;
@Autowired
RedisUtils
redisUtils
;
@Override
@Override
public
Result
check
(
QdUserSignInRequestDto
dto
)
{
public
Result
check
(
QdUserSignInRequestDto
dto
)
{
...
@@ -146,10 +149,19 @@ public class QdUserSignInServiceImpl implements QdUserSignInService {
...
@@ -146,10 +149,19 @@ public class QdUserSignInServiceImpl implements QdUserSignInService {
wxCheckMediaRequestDto
.
setMediaUrl
(
dto
.
getImages
().
get
(
0
));
wxCheckMediaRequestDto
.
setMediaUrl
(
dto
.
getImages
().
get
(
0
));
qdWxAppletApi
.
checkMedia
(
wxCheckMediaRequestDto
);
qdWxAppletApi
.
checkMedia
(
wxCheckMediaRequestDto
);
logger
.
info
(
"=========== 微信音频内容安全识别接口调用成功 ==========="
);
logger
.
info
(
"=========== 微信音频内容安全识别接口调用成功 ==========="
);
String
key
=
dto
.
getUserId
()
+
"_signIn"
;
if
(!
redisUtils
.
hasKey
(
key
))
{
redisUtils
.
set
(
key
,
key
,
30
);
return
Result
.
failed
(
"图片安全检测有风险,请更换"
);
}
}
}
wxCheckMediaRequestDto
.
setWordStr
(
dto
.
getContent
());
qdWxAppletApi
.
checkWord
(
wxCheckMediaRequestDto
);
wxCheckMediaRequestDto
.
setWordStr
(
dto
.
getContent
());
boolean
result
=
qdWxAppletApi
.
checkWord
(
wxCheckMediaRequestDto
);
logger
.
info
(
"=========== 微信文字内容安全识别接口调用成功 ==========="
);
if
(!
result
)
{
return
Result
.
failed
(
"发布的文字内容识别有风险,不可发布"
);
}
//签到记录id
//签到记录id
Long
recordId
=
null
;
Long
recordId
=
null
;
//今天尚未签到,则进行记录,先查询昨天的打卡记录,有则再连续打卡天数上+1,没有则算签到第一天
//今天尚未签到,则进行记录,先查询昨天的打卡记录,有则再连续打卡天数上+1,没有则算签到第一天
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/qiandao/QdUserSignInController.java
View file @
c0676efd
...
@@ -71,10 +71,6 @@ public class QdUserSignInController {
...
@@ -71,10 +71,6 @@ public class QdUserSignInController {
String
url
=
storageService
.
store
(
targetInput
,
file
.
getSize
(),
file
.
getContentType
(),
originalFilename
);
String
url
=
storageService
.
store
(
targetInput
,
file
.
getSize
(),
file
.
getContentType
(),
originalFilename
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"url"
,
url
);
map
.
put
(
"url"
,
url
);
logger
.
info
(
"【请求结束】乾岛上传文件,响应结果:{}"
,
JSONObject
.
toJSONString
(
map
));
logger
.
info
(
"【请求结束】乾岛上传文件,响应结果:{}"
,
JSONObject
.
toJSONString
(
map
));
return
Result
.
success
(
map
);
return
Result
.
success
(
map
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
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