Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
O
on-site-service
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
external
on-site-service
Commits
cb70febf
Commit
cb70febf
authored
Jul 27, 2022
by
shangtx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 微信依赖更新
parent
e39619c8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
4 deletions
+15
-4
AdminWeixinService.java
...nsiteservice/admin/service/weixin/AdminWeixinService.java
+1
-1
WeiXinService.java
...m/onsiteservice/miniapp/service/weixin/WeiXinService.java
+13
-2
pom.xml
pom.xml
+1
-1
No files found.
admin/src/main/java/com/onsiteservice/admin/service/weixin/AdminWeixinService.java
View file @
cb70febf
...
...
@@ -26,7 +26,7 @@ public class AdminWeixinService {
try
{
// 获取base64数据
byte
[]
qrCode
=
wxMaService
.
getQrcodeService
().
createWxaCodeUnlimitBytes
(
miniQrCodeDTO
.
getScene
(),
miniQrCodeDTO
.
getPath
(),
miniQrCodeDTO
.
getWidth
(),
false
,
new
WxMaCodeLineColor
(
"0"
,
"0"
,
"0"
),
false
);
miniQrCodeDTO
.
getPath
(),
false
,
"release"
,
miniQrCodeDTO
.
getWidth
(),
false
,
new
WxMaCodeLineColor
(
"0"
,
"0"
,
"0"
),
false
);
return
success
(
qrCode
,
"获取微信小程序码成功"
);
}
catch
(
Exception
e
)
{
throw
new
ServiceException
(
"获取微信小程序码失败"
);
...
...
mini-app/src/main/java/com/onsiteservice/miniapp/service/weixin/WeiXinService.java
View file @
cb70febf
...
...
@@ -7,6 +7,7 @@ import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
import
cn.binarywang.wx.miniapp.bean.WxMaUserInfo
;
import
com.google.common.collect.ImmutableMap
;
import
com.onsiteservice.common.service.dto.MiniQrCodeDTO
;
import
com.onsiteservice.constant.enums.EnvironmentEnum
;
import
com.onsiteservice.constant.enums.ServiceUserTypeEnum
;
import
com.onsiteservice.core.exception.ServiceException
;
import
com.onsiteservice.core.result.Result
;
...
...
@@ -21,6 +22,7 @@ import io.micrometer.core.instrument.util.StringUtils;
import
lombok.extern.slf4j.Slf4j
;
import
me.chanjar.weixin.common.error.WxErrorException
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -49,6 +51,8 @@ public class WeiXinService {
private
UserService
userService
;
@Resource
private
ServicePromoteService
promoteService
;
@Value
(
"${spring.profiles.active:dev}"
)
private
String
env
;
/**
...
...
@@ -61,6 +65,7 @@ public class WeiXinService {
// 获取openid、unionid、session_key等
sessionResult
=
wxMaService
.
getUserService
().
getSessionInfo
(
loginDTO
.
getCode
());
}
catch
(
WxErrorException
e
)
{
e
.
printStackTrace
();
throw
new
ServiceException
(
"微信小程序登录失败:"
+
e
.
getMessage
());
}
String
unionId
=
sessionResult
.
getUnionid
();
// unionId需要先在微信开放平台绑定平台
...
...
@@ -157,10 +162,16 @@ public class WeiXinService {
public
Result
getQrCode
(
MiniQrCodeDTO
miniQrCodeDTO
)
{
try
{
// 获取base64数据
byte
[]
qrCode
=
wxMaService
.
getQrcodeService
().
createWxaCodeUnlimitBytes
(
miniQrCodeDTO
.
getScene
(),
miniQrCodeDTO
.
getPath
(),
miniQrCodeDTO
.
getWidth
(),
false
,
new
WxMaCodeLineColor
(
"0"
,
"0"
,
"0"
),
false
);
byte
[]
qrCode
=
wxMaService
.
getQrcodeService
().
createWxaCodeUnlimitBytes
(
miniQrCodeDTO
.
getScene
(),
miniQrCodeDTO
.
getPath
(),
false
,
"release"
,
miniQrCodeDTO
.
getWidth
(),
false
,
new
WxMaCodeLineColor
(
"0"
,
"0"
,
"0"
),
false
);
return
success
(
qrCode
,
"获取微信小程序码成功"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"{}"
,
e
);
throw
new
ServiceException
(
"获取微信小程序码失败"
);
}
}
...
...
pom.xml
View file @
cb70febf
...
...
@@ -22,7 +22,7 @@
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
<mapstruct.version>
1.3.1.Final
</mapstruct.version>
<lombok.version>
1.18.12
</lombok.version>
<weixin.version>
4.
2
.0
</weixin.version>
<weixin.version>
4.
3
.0
</weixin.version>
</properties>
<!-- 项目子模块 -->
...
...
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