Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
promotion-service
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
promotion
promotion-service
Commits
cd58cc54
提交
cd58cc54
authored
4月 09, 2024
作者:
李秋林
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
暂存代码
上级
e73c5435
隐藏空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
637 行增加
和
5 行删除
+637
-5
pom.xml
pom.xml
+15
-0
WxMaConfiguration.java
...wangxiaolu/promotion/config/weixin/WxMaConfiguration.java
+131
-0
WxMaProperties.java
...om/wangxiaolu/promotion/config/weixin/WxMaProperties.java
+45
-0
WeChatUserCoreController.java
...promotion/controller/wechat/WeChatUserCoreController.java
+39
-0
WeChatUserQueryController.java
...romotion/controller/wechat/WeChatUserQueryController.java
+38
-0
WxTemporaryInfoDao.java
...gxiaolu/promotion/domain/user/dao/WxTemporaryInfoDao.java
+10
-0
WxTemporaryInfoDaoImpl.java
...romotion/domain/user/dao/impl/WxTemporaryInfoDaoImpl.java
+18
-0
WxTemporaryInfoDto.java
...angxiaolu/promotion/pojo/user/dto/WxTemporaryInfoDto.java
+79
-0
WxJsUserInfoVo.java
...com/wangxiaolu/promotion/pojo/user/vo/WxJsUserInfoVo.java
+106
-0
WeChatUserCoreService.java
...iaolu/promotion/service/wechat/WeChatUserCoreService.java
+16
-0
WeChatUserCoreServiceImpl.java
...motion/service/wechat/impl/WeChatUserCoreServiceImpl.java
+31
-0
OkHttp.java
src/main/java/com/wangxiaolu/promotion/utils/OkHttp.java
+2
-5
WxMaUtils.java
src/main/java/com/wangxiaolu/promotion/utils/WxMaUtils.java
+57
-0
application.yml
src/main/resources/application.yml
+10
-0
WeChatUserCoreControllerTest.java
...otion/controller/wechat/WeChatUserCoreControllerTest.java
+40
-0
没有找到文件。
pom.xml
浏览文件 @
cd58cc54
...
...
@@ -122,6 +122,21 @@
<version>
1.15
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk18on -->
<dependency>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcprov-jdk15on
</artifactId>
<version>
1.64
</version>
</dependency>
<!-- 微信小程序 SDK 依赖 -->
<dependency>
<groupId>
com.github.binarywang
</groupId>
<artifactId>
weixin-java-miniapp
</artifactId>
<version>
4.6.0
</version>
</dependency>
</dependencies>
<build>
...
...
src/main/java/com/wangxiaolu/promotion/config/weixin/WxMaConfiguration.java
0 → 100644
浏览文件 @
cd58cc54
package
com
.
wangxiaolu
.
promotion
.
config
.
weixin
;
import
cn.binarywang.wx.miniapp.api.WxMaService
;
import
cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl
;
import
cn.binarywang.wx.miniapp.bean.WxMaKefuMessage
;
import
cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage
;
import
cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl
;
import
cn.binarywang.wx.miniapp.message.WxMaMessageHandler
;
import
cn.binarywang.wx.miniapp.message.WxMaMessageRouter
;
import
com.google.common.collect.Lists
;
import
lombok.extern.slf4j.Slf4j
;
import
me.chanjar.weixin.common.bean.result.WxMediaUploadResult
;
import
me.chanjar.weixin.common.error.WxErrorException
;
import
me.chanjar.weixin.common.error.WxRuntimeException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
java.io.File
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
@Slf4j
@Configuration
@EnableConfigurationProperties
(
WxMaProperties
.
class
)
public
class
WxMaConfiguration
{
private
final
WxMaProperties
properties
;
@Autowired
public
WxMaConfiguration
(
WxMaProperties
properties
)
{
this
.
properties
=
properties
;
}
@Bean
public
WxMaService
wxMaService
()
{
List
<
WxMaProperties
.
Config
>
configs
=
this
.
properties
.
getConfigs
();
if
(
configs
==
null
)
{
throw
new
WxRuntimeException
(
"微信相关配置错误"
);
}
WxMaService
maService
=
new
WxMaServiceImpl
();
maService
.
setMultiConfigs
(
configs
.
stream
()
.
map
(
a
->
{
WxMaDefaultConfigImpl
config
=
new
WxMaDefaultConfigImpl
();
// WxMaDefaultConfigImpl config = new WxMaRedisConfigImpl(new JedisPool());
// 使用上面的配置时,需要同时引入jedis-lock的依赖,否则会报类无法找到的异常
config
.
setAppid
(
a
.
getAppid
());
config
.
setSecret
(
a
.
getSecret
());
config
.
setToken
(
a
.
getToken
());
config
.
setAesKey
(
a
.
getAesKey
());
config
.
setMsgDataFormat
(
a
.
getMsgDataFormat
());
return
config
;
}).
collect
(
Collectors
.
toMap
(
WxMaDefaultConfigImpl:
:
getAppid
,
a
->
a
,
(
o
,
n
)
->
o
)));
return
maService
;
}
@Bean
public
WxMaMessageRouter
wxMaMessageRouter
(
WxMaService
wxMaService
)
{
final
WxMaMessageRouter
router
=
new
WxMaMessageRouter
(
wxMaService
);
router
.
rule
().
handler
(
logHandler
).
next
()
.
rule
().
async
(
false
).
content
(
"订阅消息"
).
handler
(
subscribeMsgHandler
).
end
()
.
rule
().
async
(
false
).
content
(
"文本"
).
handler
(
textHandler
).
end
()
.
rule
().
async
(
false
).
content
(
"图片"
).
handler
(
picHandler
).
end
()
.
rule
().
async
(
false
).
content
(
"二维码"
).
handler
(
qrcodeHandler
).
end
();
return
router
;
}
private
final
WxMaMessageHandler
subscribeMsgHandler
=
(
wxMessage
,
context
,
service
,
sessionManager
)
->
{
service
.
getMsgService
().
sendSubscribeMsg
(
WxMaSubscribeMessage
.
builder
()
.
templateId
(
"此处更换为自己的模板id"
)
.
data
(
Lists
.
newArrayList
(
new
WxMaSubscribeMessage
.
MsgData
(
"keyword1"
,
"339208499"
)))
.
toUser
(
wxMessage
.
getFromUser
())
.
build
());
return
null
;
};
private
final
WxMaMessageHandler
logHandler
=
(
wxMessage
,
context
,
service
,
sessionManager
)
->
{
log
.
info
(
"收到消息:"
+
wxMessage
.
toString
());
service
.
getMsgService
().
sendKefuMsg
(
WxMaKefuMessage
.
newTextBuilder
().
content
(
"收到信息为:"
+
wxMessage
.
toJson
())
.
toUser
(
wxMessage
.
getFromUser
()).
build
());
return
null
;
};
private
final
WxMaMessageHandler
textHandler
=
(
wxMessage
,
context
,
service
,
sessionManager
)
->
{
service
.
getMsgService
().
sendKefuMsg
(
WxMaKefuMessage
.
newTextBuilder
().
content
(
"回复文本消息"
)
.
toUser
(
wxMessage
.
getFromUser
()).
build
());
return
null
;
};
private
final
WxMaMessageHandler
picHandler
=
(
wxMessage
,
context
,
service
,
sessionManager
)
->
{
try
{
WxMediaUploadResult
uploadResult
=
service
.
getMediaService
()
.
uploadMedia
(
"image"
,
"png"
,
ClassLoader
.
getSystemResourceAsStream
(
"tmp.png"
));
service
.
getMsgService
().
sendKefuMsg
(
WxMaKefuMessage
.
newImageBuilder
()
.
mediaId
(
uploadResult
.
getMediaId
())
.
toUser
(
wxMessage
.
getFromUser
())
.
build
());
}
catch
(
WxErrorException
e
)
{
e
.
printStackTrace
();
}
return
null
;
};
private
final
WxMaMessageHandler
qrcodeHandler
=
(
wxMessage
,
context
,
service
,
sessionManager
)
->
{
try
{
final
File
file
=
service
.
getQrcodeService
().
createQrcode
(
"123"
,
430
);
WxMediaUploadResult
uploadResult
=
service
.
getMediaService
().
uploadMedia
(
"image"
,
file
);
service
.
getMsgService
().
sendKefuMsg
(
WxMaKefuMessage
.
newImageBuilder
()
.
mediaId
(
uploadResult
.
getMediaId
())
.
toUser
(
wxMessage
.
getFromUser
())
.
build
());
}
catch
(
WxErrorException
e
)
{
e
.
printStackTrace
();
}
return
null
;
};
}
src/main/java/com/wangxiaolu/promotion/config/weixin/WxMaProperties.java
0 → 100644
浏览文件 @
cd58cc54
package
com
.
wangxiaolu
.
promotion
.
config
.
weixin
;
import
lombok.Data
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
java.util.List
;
/**
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
@Data
@ConfigurationProperties
(
prefix
=
"wx.miniapp"
)
public
class
WxMaProperties
{
private
List
<
Config
>
configs
;
@Data
public
static
class
Config
{
/**
* 设置微信小程序的appid
*/
private
String
appid
;
/**
* 设置微信小程序的Secret
*/
private
String
secret
;
/**
* 设置微信小程序消息服务器配置的token
*/
private
String
token
;
/**
* 设置微信小程序消息服务器配置的EncodingAESKey
*/
private
String
aesKey
;
/**
* 消息格式,XML或者JSON
*/
private
String
msgDataFormat
;
}
}
src/main/java/com/wangxiaolu/promotion/controller/wechat/WeChatUserCoreController.java
0 → 100644
浏览文件 @
cd58cc54
package
com
.
wangxiaolu
.
promotion
.
controller
.
wechat
;
import
com.alibaba.fastjson.JSONObject
;
import
com.wangxiaolu.promotion.pojo.user.vo.WxJsUserInfoVo
;
import
com.wangxiaolu.promotion.service.wechat.WeChatUserCoreService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @author : liqiulin
* @date : 2024-04-03 17
* @describe : 微信用户信息
*/
@Slf4j
@RestController
@RequestMapping
(
"/user/wechat/core"
)
public
class
WeChatUserCoreController
{
@Autowired
WeChatUserCoreService
weChatUserCoreService
;
/**
* 促销员注册信息
*/
@PostMapping
(
"/temporary/enroll"
)
public
boolean
enrollUserInfo
(
@RequestBody
@Validated
WxJsUserInfoVo
wxJsUserInfoVo
)
{
System
.
out
.
println
(
"=============== controller-WxJsUserInfoVo ==============="
);
System
.
out
.
println
(
JSONObject
.
toJSONString
(
wxJsUserInfoVo
));
weChatUserCoreService
.
saveWxUserInfoTemporary
(
wxJsUserInfoVo
);
return
true
;
}
}
src/main/java/com/wangxiaolu/promotion/controller/wechat/WeChatUserQueryController.java
0 → 100644
浏览文件 @
cd58cc54
package
com
.
wangxiaolu
.
promotion
.
controller
.
wechat
;
import
com.wangxiaolu.promotion.utils.WxMaUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @author : liqiulin
* @date : 2024-04-09 13
* @describe :微信用户信息查询
*/
@Slf4j
@RestController
@RequestMapping
(
"/user/wechat/query"
)
public
class
WeChatUserQueryController
{
@Autowired
WxMaUtils
wxMaUtils
;
/**
* 接收wx临时登录凭证code,查询openid是否已注册
* 促销员查询
*/
@GetMapping
(
"/temporary/openid"
)
public
Boolean
getOpenIdByWxcode
(
String
jsCode
)
{
if
(
StringUtils
.
isEmpty
(
jsCode
)){
return
null
;
}
String
userOpenId
=
wxMaUtils
.
getWxOpenId
(
jsCode
);
System
.
out
.
println
(
"根据userOpenId查询用户是否存在:"
+
userOpenId
);
return
true
;
}
}
src/main/java/com/wangxiaolu/promotion/domain/user/dao/WxTemporaryInfoDao.java
0 → 100644
浏览文件 @
cd58cc54
package
com
.
wangxiaolu
.
promotion
.
domain
.
user
.
dao
;
/**
* @author : liqiulin
* @date : 2024-04-08 16
* @describe :微信-促销员-信息
*/
public
interface
WxTemporaryInfoDao
{
void
saveTemporaryInfo
();
}
src/main/java/com/wangxiaolu/promotion/domain/user/dao/impl/WxTemporaryInfoDaoImpl.java
0 → 100644
浏览文件 @
cd58cc54
package
com
.
wangxiaolu
.
promotion
.
domain
.
user
.
dao
.
impl
;
import
com.wangxiaolu.promotion.domain.user.dao.WxTemporaryInfoDao
;
import
org.springframework.stereotype.Service
;
/**
* @author : liqiulin
* @date : 2024-04-08 16
* @describe :
*/
@Service
public
class
WxTemporaryInfoDaoImpl
implements
WxTemporaryInfoDao
{
@Override
public
void
saveTemporaryInfo
()
{
}
}
src/main/java/com/wangxiaolu/promotion/pojo/user/dto/WxTemporaryInfoDto.java
0 → 100644
浏览文件 @
cd58cc54
package
com
.
wangxiaolu
.
promotion
.
pojo
.
user
.
dto
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.experimental.Accessors
;
/**
* @author : liqiulin
* @date : 2024-04-08 16
* @describe :微信促销员DTO
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors
(
chain
=
true
)
public
class
WxTemporaryInfoDto
{
/**
* openId
*/
String
openId
;
/**
* 头像
*/
String
avatarUrl
;
/**
* 头像云存储文件id
*/
String
avatarUrlFieldId
;
/**
* 姓名
*/
String
name
;
/**
* 手机号
*/
String
phone
;
/**
* 身份证号
*/
String
idenNmber
;
/**
* 身份证正面照
*/
String
idenFrontPhotoUrl
;
/**
* 身份证正面照
*/
String
idenFrontPhotoFieldId
;
/**
* 身份证反面照
*/
String
idenReversePhotoUrl
;
/**
* 身份证反面照
*/
String
idenReversePhotoFieldId
;
/**
* 详细地址
*/
String
address
;
/**
* 手机验证码
*/
String
phoneCode
;
}
src/main/java/com/wangxiaolu/promotion/pojo/user/vo/WxJsUserInfoVo.java
0 → 100644
浏览文件 @
cd58cc54
package
com
.
wangxiaolu
.
promotion
.
pojo
.
user
.
vo
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotBlank
;
/**
* @author : liqiulin
* @date : 2024-04-08 12
* @describe :
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors
(
chain
=
true
)
public
class
WxJsUserInfoVo
{
/**
* js传过来的临时登录code
*/
// @NotBlank(message = "微信登录凭证错误")
// String jsCode;
/**
* 用户信息的加密文字
*/
// String encryptedData;
/**
* 标识
*/
// String iv;
/**
* openId
*/
@NotBlank
(
message
=
"微信登录错误"
)
String
openId
;
/**
* 头像
*/
String
avatarUrl
;
/**
* 头像云存储文件id
*/
String
avatarUrlFieldId
;
/**
* 姓名
*/
@NotBlank
(
message
=
"姓名不可为空"
)
String
name
;
/**
* 手机号
*/
@NotBlank
(
message
=
"手机号不可为空"
)
String
phone
;
/**
* 身份证号
*/
@NotBlank
(
message
=
"身份证号不可为空"
)
String
idenNmber
;
/**
* 身份证正面照
*/
@NotBlank
(
message
=
"请上传身份证正面照"
)
String
idenFrontPhotoUrl
;
/**
* 身份证正面照
*/
@NotBlank
(
message
=
"请上传身份证正面照"
)
String
idenFrontPhotoFieldId
;
/**
* 身份证反面照
*/
@NotBlank
(
message
=
"请上传身份证反面照"
)
String
idenReversePhotoUrl
;
/**
* 身份证反面照
*/
@NotBlank
(
message
=
"请上传身份证反面照"
)
String
idenReversePhotoFieldId
;
/**
* 详细地址
*/
String
address
;
/**
* 手机验证码
*/
@NotBlank
(
message
=
"验证码无效"
)
String
phoneCode
;
}
src/main/java/com/wangxiaolu/promotion/service/wechat/WeChatUserCoreService.java
0 → 100644
浏览文件 @
cd58cc54
package
com
.
wangxiaolu
.
promotion
.
service
.
wechat
;
import
com.wangxiaolu.promotion.pojo.user.vo.WxJsUserInfoVo
;
/**
* @author : liqiulin
* @date : 2024-04-08 16
* @describe :微信信息操作
*/
public
interface
WeChatUserCoreService
{
/**
* 保存促销员用户信息
*/
void
saveWxUserInfoTemporary
(
WxJsUserInfoVo
wxJsUserInfoVo
);
}
src/main/java/com/wangxiaolu/promotion/service/wechat/impl/WeChatUserCoreServiceImpl.java
0 → 100644
浏览文件 @
cd58cc54
package
com
.
wangxiaolu
.
promotion
.
service
.
wechat
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.wangxiaolu.promotion.pojo.user.dto.WxTemporaryInfoDto
;
import
com.wangxiaolu.promotion.pojo.user.vo.WxJsUserInfoVo
;
import
com.wangxiaolu.promotion.service.wechat.WeChatUserCoreService
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
/**
* @author : liqiulin
* @date : 2024-04-08 16
* @describe :微信用户信息操作
*/
@Service
public
class
WeChatUserCoreServiceImpl
implements
WeChatUserCoreService
{
/**
* 保存促销员用户信息
*/
@Override
public
void
saveWxUserInfoTemporary
(
WxJsUserInfoVo
wxJsUserInfoVo
)
{
WxTemporaryInfoDto
temporaryDto
=
new
WxTemporaryInfoDto
();
BeanUtils
.
copyProperties
(
wxJsUserInfoVo
,
temporaryDto
);
System
.
out
.
println
(
"=============== impl-WxTemporaryInfoDto ==============="
);
System
.
out
.
println
(
JSONObject
.
toJSONString
(
temporaryDto
));
}
}
src/main/java/com/wangxiaolu/promotion/utils/OkHttp.java
浏览文件 @
cd58cc54
package
com
.
wangxiaolu
.
promotion
.
utils
;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
java.util.Map
;
...
...
@@ -14,14 +13,12 @@ import java.util.Map;
public
class
OkHttp
{
public
static
JSONObject
post
(
String
url
,
Map
<
String
,
Object
>
params
)
{
String
requestBody
=
HttpUtil
.
createPost
(
url
).
contentType
(
"application/json;charset=utf-8"
).
body
(
JSONObject
.
toJSONString
(
params
)).
execute
().
body
();
String
requestBody
=
HttpUtil
.
createPost
(
url
).
contentType
(
"application/json;charset=utf-8"
).
body
(
JSONObject
.
toJSONString
(
params
)).
execute
().
body
();
JSONObject
resultJson
=
JSONObject
.
parseObject
(
requestBody
);
String
returnCode
=
resultJson
.
getString
(
"return_code"
);
if
(!
"0"
.
equals
(
returnCode
)){
if
(!
"0"
.
equals
(
returnCode
))
{
throw
new
RuntimeException
(
"OkHttp.post请求error,详情:"
+
requestBody
);
}
return
resultJson
;
}
}
src/main/java/com/wangxiaolu/promotion/utils/WxMaUtils.java
0 → 100644
浏览文件 @
cd58cc54
package
com
.
wangxiaolu
.
promotion
.
utils
;
import
cn.binarywang.wx.miniapp.api.WxMaService
;
import
cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult
;
import
cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo
;
import
cn.binarywang.wx.miniapp.bean.WxMaUserInfo
;
import
lombok.AllArgsConstructor
;
import
me.chanjar.weixin.common.error.WxErrorException
;
import
org.springframework.stereotype.Component
;
/**
* @author : liqiulin
* @date : 2024-04-08 11
* @describe : 微信工具
*/
@AllArgsConstructor
@Component
public
class
WxMaUtils
{
private
final
WxMaService
wxMaService
;
/**
* 根据code查询openId
*/
public
String
getWxOpenId
(
String
jsCode
)
{
WxMaJscode2SessionResult
sessionInfo
=
null
;
try
{
sessionInfo
=
wxMaService
.
getUserService
().
getSessionInfo
(
jsCode
);
String
openid
=
sessionInfo
.
getOpenid
();
return
openid
;
}
catch
(
WxErrorException
e
)
{
throw
new
RuntimeException
();
}
}
/**
* 微信用户信息解密
* (粗糙信息)
*/
public
String
decrUserInfo
(
String
jsCode
,
String
encryptedData
,
String
iv
)
{
WxMaJscode2SessionResult
sessionInfo
=
null
;
try
{
sessionInfo
=
wxMaService
.
getUserService
().
getSessionInfo
(
jsCode
);
String
openid
=
sessionInfo
.
getOpenid
();
String
sessionKey
=
sessionInfo
.
getSessionKey
();
WxMaPhoneNumberInfo
phoneNoInfo
=
wxMaService
.
getUserService
().
getPhoneNoInfo
(
sessionKey
,
encryptedData
,
iv
);
String
phoneNumber
=
phoneNoInfo
.
getPhoneNumber
();
WxMaUserInfo
userInfo
=
wxMaService
.
getUserService
().
getUserInfo
(
sessionKey
,
encryptedData
,
iv
);
}
catch
(
WxErrorException
e
)
{
throw
new
RuntimeException
(
e
);
}
return
null
;
}
}
src/main/resources/application.yml
浏览文件 @
cd58cc54
...
...
@@ -22,3 +22,12 @@ async:
core_pool_size
:
4
name
:
prefix
:
promotion-
wx
:
miniapp
:
configs
:
-
appid
:
wxac14dc7765484d7d
secret
:
b3315e66608a397f88e7e82b8f950bcd
token
:
#微信小程序消息服务器配置的token
aesKey
:
#微信小程序消息服务器配置的EncodingAESKey
msgDataFormat
:
JSON
\ No newline at end of file
src/test/java/com/wangxiaolu/promotion/controller/wechat/WeChatUserCoreControllerTest.java
0 → 100644
浏览文件 @
cd58cc54
package
com
.
wangxiaolu
.
promotion
.
controller
.
wechat
;
import
com.wangxiaolu.promotion.pojo.user.vo.WxJsUserInfoVo
;
import
org.junit.jupiter.api.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.*;
/**
* @author : liqiulin
* @date : 2024-04-08 16
* @describe :
*/
@SpringBootTest
@RunWith
(
SpringRunner
.
class
)
class
WeChatUserCoreControllerTest
{
@Autowired
WeChatUserCoreController
weChatUserCoreController
;
@Test
void
enrollUserInfo
()
{
WxJsUserInfoVo
vo
=
new
WxJsUserInfoVo
()
.
setJsCode
(
"js传过来的临时登录code"
)
.
setEncryptedData
(
"用户信息的加密文字"
)
.
setIv
(
"标识iv"
)
.
setOpenId
(
"openid111"
)
.
setAvatarUrl
(
"头像"
)
.
setName
(
"姓名"
)
.
setPhone
(
"手机号"
)
.
setIdenNmber
(
"身份证号"
)
.
setAddress
(
"地址111"
)
;
weChatUserCoreController
.
enrollUserInfo
(
vo
);
}
}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论