提交 e4a9dfbe 编写于 作者: 雪洛's avatar 雪洛

deps: bump uni-open-bridge-common from 1.0.0 to 1.0.2

上级 098b4780
## 1.0.2(2022-09-02)
- 新增 依赖数据表schema opendb-open-data
## 1.0.0(2022-08-22) ## 1.0.0(2022-08-22)
- 首次发布 - 首次发布
{ {
"id": "uni-open-bridge-common", "id": "uni-open-bridge-common",
"displayName": "uni-open-bridge-common", "displayName": "uni-open-bridge-common",
"version": "1.0.0", "version": "1.0.2",
"description": "统一接管微信等三方平台认证凭据", "description": "统一接管微信等三方平台认证凭据",
"keywords": [ "keywords": [
"uni-open-bridge-common", "uni-open-bridge-common",
......
'use strict'; 'use strict';
const TAG = "UNI_OPEN_BRIDGE"
const HTTP_STATUS = { const HTTP_STATUS = {
SUCCESS: 200 SUCCESS: 200
} }
...@@ -13,7 +15,12 @@ const PlatformType = { ...@@ -13,7 +15,12 @@ const PlatformType = {
QQ_APP: 'qq-app' QQ_APP: 'qq-app'
} }
const ErrorCodeType = {
SYSTEM_ERROR: TAG + "_SYSTEM_ERROR"
}
module.exports = { module.exports = {
HTTP_STATUS, HTTP_STATUS,
PlatformType PlatformType,
ErrorCodeType
} }
'use strict'; 'use strict';
const { const {
PlatformType PlatformType,
ErrorCodeType
} = require('./consts.js') } = require('./consts.js')
const { const {
...@@ -31,8 +32,15 @@ class AccessToken extends Storage { ...@@ -31,8 +32,15 @@ class AccessToken extends Storage {
async fallback(parameters) { async fallback(parameters) {
const oauthConfig = appConfig.get(parameters.dcloudAppid, parameters.platform) const oauthConfig = appConfig.get(parameters.dcloudAppid, parameters.platform)
const methodName = (parameters.platform === PlatformType.WEIXIN_MP) ? 'GetMPAccessTokenData' : let methodName
'GetH5AccessTokenData' if (parameters.platform === PlatformType.WEIXIN_MP) {
methodName = 'GetMPAccessTokenData'
} else if (parameters.platform === PlatformType.WEIXIN_H5) {
methodName = 'GetH5AccessTokenData'
} else {
throw new BridgeError(ErrorCodeType.SYSTEM_ERROR, "platform invalid")
}
const responseData = await WeixinServer[methodName](oauthConfig) const responseData = await WeixinServer[methodName](oauthConfig)
const duration = responseData.expires_in const duration = responseData.expires_in
...@@ -206,5 +214,6 @@ module.exports = { ...@@ -206,5 +214,6 @@ module.exports = {
setTicket, setTicket,
removeTicket, removeTicket,
PlatformType, PlatformType,
WeixinServer WeixinServer,
ErrorCodeType
} }
// 文档教程: https://uniapp.dcloud.net.cn/uniCloud/schema
{
"bsonType": "object",
"required": ["_id", "value"],
"properties": {
"_id": {
"bsonType": "string",
"description": "key,格式:uni-id:[dcloudAppid]:[platform]:[openid]:[access-token|user-access-token|session-key|encrypt-key-version|ticket]"
},
"value": {
"bsonType": "object",
"description": "字段_id对应的值"
},
"expired": {
"bsonType": "date",
"description": "过期时间"
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册