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 6f9e3023d5820aa2ae4d67ce9415b0a8be98c3a2..0739bf25bf2589a5b1a42d3afd0ec20ef2ba6826 100644 --- a/common/appInit.js +++ b/common/appInit.js @@ -120,17 +120,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) @@ -476,8 +489,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: '获取推送标识失败。如果你的应用不需要推送功能,请注释掉本代码块', @@ -493,8 +505,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 01df37fc64cce0a6b0dffa99ab9121e9e58828bf..8ee7d160e3aa260e7c54f2db2f43ae8dff19587d 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 @@