diff --git a/changelog.md b/changelog.md index 097cf58ff7e038f2373c31585124d6b613624f67..2aea518dd55febacde7b7c08af9f0e9547d7ec76 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,7 @@ +## 1.1.30(2022-01-26) +- 新增逻辑:调用uni-id-cf的logout接口后刷新设备信息中token的有效期 +- 修复某些情况下前端执行logout没调用uniID.logout的问题 +- 修复某些情况下报push_clientid未定义的问题 ## 1.1.29(2022-01-25) - 保存`uni_id_token`到`storage`改用异步方法,方便通过拦截器执行`token`更新后的操作 - 新增通过拦截器监听`uni_id_token`更新,调用云函数刷新刷新设备信息token有效期的API `renewDeviceTokenExpired` diff --git a/common/appInit.js b/common/appInit.js index 279adf557af0cd68576d2f7f57bf700316ad4d78..ffddd6ea3105393cf29f5e0182d3f6f7720cb86e 100644 --- a/common/appInit.js +++ b/common/appInit.js @@ -119,17 +119,30 @@ export default async function() { if (args.data && args.key == 'uni_id_token') { let oldToken = uni.getStorageSync('uni_id_token') if(oldToken.length){ - console.log('监听到token更新,就刷新push_clientid的有效期'); - uniCloud.callFunction({ - name:'uni-id-cf', - data:{ - "action": "renewDeviceTokenExpiredxpired", - "params": {push_clientid} - }, - complete: (e) => { - console.log(e); - } - }) + console.log('监听到token更新,就刷新push_clientid的有效期'); + // #ifdef APP-PLUS + let push_clientid; + try { + push_clientid = plus.push.getClientInfo().clientid + } catch (e) { + uni.showModal({ + content: '获取推送标识失败。如果你的应用不需要推送功能,请注释掉本代码块', + showCancel: false, + confirmText: "好的" + }); + console.log(e) + } + uniCloud.callFunction({ + name:'uni-id-cf', + data:{ + "action": "renewDeviceTokenExpiredxpired", + "params": {push_clientid} + }, + complete: (e) => { + console.log(e); + } + }) + // #endif } } // console.log('interceptor-complete', args) @@ -475,8 +488,7 @@ async function getDeviceInfo() { idfa = plus.storage.getItem('idfa') || '', //idfa有需要的用户在应用首次启动时自己获取存储到storage中 vendor = plus.device.vendor; try { - deviceInfo.push_clientid = uni.getStorageSync('cid') //先都走在线 - // deviceInfo.push_clientid = plus.push.getClientInfo().clientid + deviceInfo.push_clientid = plus.push.getClientInfo().clientid } catch (e) { uni.showModal({ content: '获取推送标识失败。如果你的应用不需要推送功能,请注释掉本代码块', @@ -492,8 +504,5 @@ async function getDeviceInfo() { vendor }); // #endif - // #ifndef APP-PLUS - deviceInfo.push_clientid = uni.getStorageSync('cid') - // #endif return deviceInfo } \ No newline at end of file diff --git a/package.json b/package.json index fd3f0798ac4b27e624936b4a05b323edc56e29f1..6f355d66f8e50daf8b1ff971d3a14b00c05fcb7f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "id": "uni-starter", "displayName": "uni-starter", - "version": "1.1.29", + "version": "1.1.30", "description": "云端一体应用快速开发基本项目模版", "keywords": [ "login", diff --git a/pages/ucenter/settings/deactivate/deactivate.vue b/pages/ucenter/settings/deactivate/deactivate.vue index e88cf44b41678e65fcdbb5e8e912006eb8deedeb..09de453b9c40d440f0b7fe15984055eed339ac82 100644 --- a/pages/ucenter/settings/deactivate/deactivate.vue +++ b/pages/ucenter/settings/deactivate/deactivate.vue @@ -23,7 +23,7 @@