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

feat: set user access token, set session key

上级 1122a86c
......@@ -35,14 +35,14 @@ async function saveQQUserKey ({
}
switch (qqPlatform) {
case 'mp':
await this.uniOpenBridge.setUserKey(keyObj, {
await this.uniOpenBridge.setSessionKey(keyObj, {
session_key: sessionKey
})
break
case 'app':
case 'h5':
case 'web':
await this.uniOpenBridge.setUserKey(keyObj, {
await this.uniOpenBridge.setUserAccessToken(keyObj, {
access_token: accessToken,
access_token_expired: accessTokenExpired
}, Math.floor((accessTokenExpired - Date.now()) / 1000))
......@@ -126,7 +126,8 @@ async function getQQCache ({
const openid = getQQOpenid.call(this, {
userRecord
})
const userKey = await this.uniOpenBridge.getUserKey({
const getCacheMethod = qqPlatform === 'mp' ? 'getSessionKey' : 'getUserAccessToken'
const userKey = await this.uniOpenBridge[getCacheMethod]({
dcloudAppid: appId,
platform: qqPlatform + '-qq',
openid
......
......@@ -67,14 +67,14 @@ async function saveWeixinUserKey ({
}
switch (weixinPlatform) {
case 'mp':
await this.uniOpenBridge.setUserKey(keyObj, {
await this.uniOpenBridge.setSessionKey(keyObj, {
session_key: sessionKey
})
break
case 'app':
case 'h5':
case 'web':
await this.uniOpenBridge.setUserKey(keyObj, {
await this.uniOpenBridge.setUserAccessToken(keyObj, {
access_token: accessToken,
refresh_token: refreshToken,
access_token_expired: accessTokenExpired
......@@ -162,7 +162,8 @@ async function getWeixinCache ({
const openid = getWeixinOpenid.call(this, {
userRecord
})
const userKey = await this.uniOpenBridge.getUserKey({
const getCacheMethod = weixinPlatform === 'mp' ? 'getSessionKey' : 'getUserAccessToken'
const userKey = await this.uniOpenBridge[getCacheMethod]({
dcloudAppid: appId,
platform: weixinPlatform + '-weixin',
openid
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册