Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
cms-ci-test
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
test-ci
cms-ci-test
Commits
16ba5568
提交
16ba5568
authored
6月 19, 2023
作者:
zhenjie
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
ssh://git.mmcuav.cn:8222/iuav/cms
上级
12a0af21
5a171e11
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
33 行增加
和
30 行删除
+33
-30
BCrypt.java
...ice-user/src/main/java/com/mmc/iuav/user/auth/BCrypt.java
+0
-2
WxController.java
.../main/java/com/mmc/iuav/user/controller/WxController.java
+3
-1
WxServiceImpl.java
...in/java/com/mmc/iuav/user/service/impl/WxServiceImpl.java
+6
-22
QccEntAuthUtil.java
.../src/main/java/com/mmc/iuav/user/util/QccEntAuthUtil.java
+0
-1
configMap.yaml
kustomization/base/configMap.yaml
+3
-0
deployment.yaml
kustomization/base/deployment.yaml
+19
-2
kustomization.yaml
kustomization/overlays/dev/kustomization.yaml
+1
-1
kustomization.yaml
kustomization/overlays/prod/kustomization.yaml
+1
-1
没有找到文件。
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/auth/BCrypt.java
浏览文件 @
16ba5568
...
...
@@ -42,9 +42,7 @@ import java.util.Arrays;
* <p>
* <code>
* if (BCrypt.checkpw(candidate_password, stored_hash))<br />
* System.out.println("It matches");<br />
* else<br />
* System.out.println("It does not match");<br />
* </code>
* <p>
* The gensalt() method takes an optional parameter (log_rounds)
...
...
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/controller/WxController.java
浏览文件 @
16ba5568
...
...
@@ -3,6 +3,7 @@ package com.mmc.iuav.user.controller;
import
com.mmc.iuav.response.ResultBody
;
import
com.mmc.iuav.user.service.WxService
;
import
io.swagger.annotations.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -18,6 +19,7 @@ import java.io.PrintWriter;
@Api
(
tags
=
"微信相关接口"
)
@RequestMapping
(
"/wx/"
)
@RestController
@Slf4j
public
class
WxController
extends
BaseController
{
@Autowired
...
...
@@ -61,7 +63,7 @@ public class WxController extends BaseController {
req
.
setCharacterEncoding
(
"UTF-8"
);
resp
.
setCharacterEncoding
(
"UTF-8"
);
PrintWriter
out
=
resp
.
getWriter
();
System
.
out
.
println
(
"##########接收到微信事件推送############"
);
log
.
info
(
"##########接收到微信事件推送############"
);
String
msg
=
wxService
.
receiveSubAccountEvents
(
req
);
out
.
println
(
msg
);
}
...
...
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/service/impl/WxServiceImpl.java
浏览文件 @
16ba5568
...
...
@@ -15,6 +15,7 @@ import com.mmc.iuav.user.model.vo.WxLoginVO;
import
com.mmc.iuav.user.model.vo.WxMsgVO
;
import
com.mmc.iuav.user.service.WxService
;
import
com.mmc.iuav.user.util.WxApiUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
...
...
@@ -32,6 +33,7 @@ import java.util.concurrent.TimeUnit;
* @Date: 2023/5/16 13:44
*/
@Service
@Slf4j
public
class
WxServiceImpl
implements
WxService
{
@Autowired
private
UserSystemConstant
userSystemConstant
;
...
...
@@ -68,7 +70,6 @@ public class WxServiceImpl implements WxService {
String
accessTokenMsg
=
HttpsRequestUtil
.
httpsGet
(
getAccessTokenUrl
,
null
);
JSONObject
tokenResult
=
JSONObject
.
parseObject
(
accessTokenMsg
);
if
(
accessTokenMsg
.
indexOf
(
"access_token"
)
==
-
1
)
{
System
.
out
.
println
(
"获取小程序access_token有误:"
+
tokenResult
);
return
null
;
}
accessToken
=
tokenResult
.
getString
(
"access_token"
);
...
...
@@ -90,7 +91,7 @@ public class WxServiceImpl implements WxService {
String
accessTokenMsg
=
HttpsRequestUtil
.
httpsGet
(
getAccessTokenUrl
,
null
);
JSONObject
tokenResult
=
JSONObject
.
parseObject
(
accessTokenMsg
);
if
(
accessTokenMsg
.
indexOf
(
"access_token"
)
==
-
1
)
{
System
.
out
.
println
(
"获取公众号access_token有误:"
+
tokenResult
);
log
.
info
(
"获取公众号access_token有误:{}"
,
tokenResult
);
return
null
;
}
accessToken
=
tokenResult
.
getString
(
"access_token"
);
...
...
@@ -112,14 +113,10 @@ public class WxServiceImpl implements WxService {
this
.
subScribeUser
(
map
);
}
else
if
(
WxConstant
.
unsubscribe
.
equals
(
event
))
{
// 取消关注事件
System
.
out
.
println
(
"############################"
);
System
.
out
.
println
(
"###########取消关注############"
);
System
.
out
.
println
(
"############################"
);
String
openId
=
map
.
get
(
"FromUserName"
);
userSubInfoDao
.
removeUserSubInfo
(
openId
);
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"接收消息异常"
+
e
.
getMessage
());
return
"error"
;
}
return
"success"
;
...
...
@@ -167,10 +164,6 @@ public class WxServiceImpl implements WxService {
// 用户是否订阅该公众号标识,值为0时,代表此用户没有关注该公众号,拉取不到其余信息。
Integer
subscribe
=
obj
.
getInteger
(
"subscribe"
);
if
(
subscribe
!=
null
&&
subscribe
==
1
)
{
System
.
out
.
println
(
"###########access_token##########"
);
System
.
out
.
println
(
accessToken
);
System
.
out
.
println
(
"###########用户信息##########"
);
System
.
out
.
println
(
jsonStr
);
UserSubInfoDO
user
=
new
UserSubInfoDO
();
user
.
setOpenId
(
openid
);
user
.
setUnionId
(
obj
.
getString
(
"unionid"
));
...
...
@@ -179,7 +172,7 @@ public class WxServiceImpl implements WxService {
userSubInfoDao
.
updateUserSubInfo
(
user
);
return
;
}
else
{
System
.
out
.
println
(
"未订阅公众号,无法拉取信息。"
);
log
.
info
(
"未订阅公众号,无法拉取信息。"
);
return
;
}
}
catch
(
Exception
e
){
...
...
@@ -190,19 +183,14 @@ public class WxServiceImpl implements WxService {
@Override
public
ResultBody
sendSubTemplateMsg
(
WxMsgVO
ws
)
{
System
.
out
.
println
(
"###########开始发送公众号消息##########"
);
String
accessToken
=
null
;
try
{
accessToken
=
this
.
getSubAccessToken
();
System
.
out
.
println
(
"accesstoken:"
+
accessToken
);
String
url
=
"https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="
+
accessToken
;
String
param
=
ws
.
buildMsgJson
();
System
.
out
.
println
(
"参数:"
+
param
);
String
result
=
HttpHelper
.
httpPost
(
url
,
param
);
System
.
out
.
println
(
"###########结束发送公众号消息##########"
);
System
.
out
.
println
(
result
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"accessToken获取失败:"
+
e
.
getMessage
());
log
.
error
(
"accessToken获取失败:{}"
,
e
.
getMessage
());
return
ResultBody
.
error
(
ResultEnum
.
WX_ACCESS_TOKEN_ERROR
.
getResultCode
(),
ResultEnum
.
WX_ACCESS_TOKEN_ERROR
.
getResultMsg
()
+
e
.
getMessage
());
}
...
...
@@ -231,7 +219,6 @@ public class WxServiceImpl implements WxService {
@Override
public
ResultBody
sendAppletMsg
(
AppletMsgVO
appletMsgVO
)
{
System
.
out
.
println
(
"###########开始发送-小程序-用户端消息##########"
);
String
accessToken
=
this
.
getAccessToken
();
if
(
StringUtils
.
isBlank
(
accessToken
)){
return
ResultBody
.
error
(
ResultEnum
.
WX_ACCESS_TOKEN_ERROR
.
getResultCode
(),
...
...
@@ -241,12 +228,10 @@ public class WxServiceImpl implements WxService {
String
url
=
"https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token="
+
accessToken
;
appletMsgVO
.
setData
(
WxApiUtil
.
buildMsgJson
(
appletMsgVO
.
getData
()));
String
param
=
JSONObject
.
toJSONString
(
appletMsgVO
);
System
.
out
.
println
(
"参数:"
+
param
);
HttpHelper
.
httpPost
(
url
,
param
);
}
catch
(
Exception
e
){
System
.
out
.
println
(
"系统异常:"
+
e
.
getMessage
());
log
.
error
(
"系统异常:{}"
,
e
.
getMessage
());
}
System
.
out
.
println
(
"###########结束发送-小程序-消息##########"
);
return
ResultBody
.
success
();
}
...
...
@@ -280,7 +265,6 @@ public class WxServiceImpl implements WxService {
String
url
=
"https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token="
+
accessToken
;
String
res
=
HttpHelper
.
httpPost
(
url
,
param
.
toString
());
JSONObject
result
=
JSONObject
.
parseObject
(
res
);
System
.
out
.
println
(
"用户授权手机号:"
+
res
);
if
(
result
.
getString
(
"errcode"
).
equals
(
"0"
))
{
String
phone_info
=
result
.
getString
(
"phone_info"
);
JSONObject
phoneInfoObject
=
JSONObject
.
parseObject
(
phone_info
);
...
...
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/util/QccEntAuthUtil.java
浏览文件 @
16ba5568
...
...
@@ -173,7 +173,6 @@ public class QccEntAuthUtil {
ObjectMapper
mapper
=
new
ObjectMapper
();
Object
obj
=
mapper
.
readValue
(
jsonString
,
Object
.
class
);
String
indented
=
mapper
.
writerWithDefaultPrettyPrinter
().
writeValueAsString
(
obj
);
System
.
out
.
println
(
indented
);
}
catch
(
JsonProcessingException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
...
...
kustomization/base/configMap.yaml
浏览文件 @
16ba5568
...
...
@@ -5,3 +5,5 @@ metadata:
namespace
:
default
data
:
SPRING_PROFILES_ACTIVE
:
default
SW_AGENT_COLLECTOR_BACKEND_SERVICES
:
"
default-oap.skywalking-swck-system:11800"
SW_AGENT_NAME
:
cms
\ No newline at end of file
kustomization/base/deployment.yaml
浏览文件 @
16ba5568
...
...
@@ -14,6 +14,7 @@ spec:
metadata
:
labels
:
app
:
cms
swck-java-agent-injected
:
'
true'
spec
:
containers
:
-
name
:
cms
...
...
@@ -21,6 +22,9 @@ spec:
volumeMounts
:
-
name
:
log-of-app
mountPath
:
/var/log/app
-
name
:
localtime
mountPath
:
/etc/localtime
readOnly
:
true
resources
:
limits
:
memory
:
1024Mi
...
...
@@ -33,7 +37,20 @@ spec:
configMapKeyRef
:
name
:
cms-map
key
:
SPRING_PROFILES_ACTIVE
-
name
:
SW_AGENT_COLLECTOR_BACKEND_SERVICES
valueFrom
:
configMapKeyRef
:
name
:
cms-map
key
:
SW_AGENT_COLLECTOR_BACKEND_SERVICES
-
name
:
SW_AGENT_NAME
valueFrom
:
configMapKeyRef
:
name
:
cms-map
key
:
SW_AGENT_NAME
volumes
:
-
name
:
log-of-app
hostPath
:
path
:
/var/log/app
\ No newline at end of file
path
:
/var/log/app
-
name
:
localtime
hostPath
:
path
:
/etc/localtime
\ No newline at end of file
kustomization/overlays/dev/kustomization.yaml
浏览文件 @
16ba5568
...
...
@@ -18,4 +18,4 @@ patches:
images
:
-
name
:
REGISTRY/NAMESPACE/IMAGE:TAG
newName
:
mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/cms
newTag
:
1
892dbcdb20f1882a6eda0f2d3f299d03df97df9
newTag
:
1
aa583dee5935e765f3334169caca635c6f907b7
kustomization/overlays/prod/kustomization.yaml
浏览文件 @
16ba5568
...
...
@@ -18,4 +18,4 @@ patches:
images
:
-
name
:
REGISTRY/NAMESPACE/IMAGE:TAG
newName
:
mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly/cms
newTag
:
a66259b9b10f0a79a0dbee5a83e733d47cb89011
newTag
:
d38385144aaeecfff8c147e07aac460ea1f01b43
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论