2021-08-26 16:21:25 +08:00
|
|
|
---
|
|
|
|
title: 微信模块
|
|
|
|
description: 微信模块功能
|
|
|
|
published: true
|
2021-08-26 17:04:33 +08:00
|
|
|
date: 2021-08-26T09:04:32.389Z
|
2021-08-26 16:21:25 +08:00
|
|
|
tags: wg-basic, wecaht
|
|
|
|
editor: markdown
|
|
|
|
dateCreated: 2021-08-26T08:21:24.080Z
|
|
|
|
---
|
|
|
|
|
|
|
|
# 模块加载
|
2021-08-26 16:23:01 +08:00
|
|
|
微信模块目前一共有两个,分别是 `login-wechat` 和 `module-wechat` 。`login-wechat` 模块不能单独使用,`module-wechat` 模块可以单独使用。
|
|
|
|
两个模块依赖分别为
|
|
|
|
```xml
|
|
|
|
|
|
|
|
<dependency>
|
|
|
|
<groupId>ink.wgink</groupId>
|
|
|
|
<artifactId>login-wechat</artifactId>
|
|
|
|
<version>1.0-SNAPSHOT</version>
|
|
|
|
</dependency>
|
|
|
|
|
|
|
|
<dependency>
|
|
|
|
<groupId>ink.wgink</groupId>
|
|
|
|
<artifactId>module-wechat</artifactId>
|
|
|
|
<version>1.0-SNAPSHOT</version>
|
|
|
|
</dependency>
|
|
|
|
|
|
|
|
```
|
|
|
|
|
2021-08-26 16:23:40 +08:00
|
|
|
# 配置说明
|
2021-08-26 16:23:52 +08:00
|
|
|
为了能够使用微信功能模块,需要在配置文件中添加如下配置
|
|
|
|
```yml
|
2021-08-26 17:04:33 +08:00
|
|
|
open-platform:
|
|
|
|
wechat:
|
|
|
|
# 支付
|
|
|
|
pay:
|
|
|
|
# 激活状态
|
|
|
|
active: true
|
|
|
|
# 生产环境
|
|
|
|
produce: true
|
|
|
|
# 商家ID
|
|
|
|
mchid: 123123123123
|
|
|
|
# 证书路径 和 名称
|
|
|
|
certificate-path: /Users/xxxxxxx_cert
|
|
|
|
certificate-name: apiclient_cert.pem
|
|
|
|
# 公钥文件路径
|
|
|
|
key-file-path: /Users/xxxxxxx/apiclient_key.pem
|
|
|
|
# api v3 秘钥
|
|
|
|
api-v3-secretkey: 111111111111111111
|
|
|
|
# 小程序
|
|
|
|
mini-app:
|
|
|
|
# 激活状态
|
|
|
|
active: true
|
|
|
|
# 认证地址,固定
|
|
|
|
authorizeUrl: https://api.weixin.qq.com/sns/jscode2session
|
|
|
|
# 认证方式,固定
|
|
|
|
grantType: authorization_code
|
|
|
|
# 小程序的appKey
|
|
|
|
appKey: 123123123123123
|
|
|
|
# 小程序秘钥
|
|
|
|
appSecret: 232323232323232323
|
|
|
|
# 公众号
|
|
|
|
official-account:
|
|
|
|
# 开启跨域
|
|
|
|
activate: false
|
|
|
|
authorize:
|
|
|
|
authorize-url: https://open.weixin.qq.com/connect/oauth2/authorize
|
|
|
|
access-token-url: https://api.weixin.qq.com/sns/oauth2/access_token
|
|
|
|
access-token-refresh-url: https://api.weixin.qq.com/sns/oauth2/refresh_token
|
|
|
|
userinfo-url: https://api.weixin.qq.com/sns/userinfo
|
|
|
|
response-type: code
|
|
|
|
scope: snsapi_userinfo
|
|
|
|
state: wechatRedirectUrl
|
|
|
|
grant-type: authorization_code
|
|
|
|
access-token-url: https://api.weixin.qq.com/cgi-bin/token
|
|
|
|
app-id: 123123123123123
|
|
|
|
app-secret: 123123123123123123
|
|
|
|
grant-type: client_credential
|
|
|
|
config-token: WenG
|
2021-08-26 16:23:52 +08:00
|
|
|
```
|