fix: 修复退出还能收到推送的情况

This commit is contained in:
kuaifan 2024-11-22 17:23:54 +08:00
parent 88aee1e3bf
commit 764bf6dd55
3 changed files with 31 additions and 12 deletions

View File

@ -1115,6 +1115,9 @@ class UsersController extends AbstractController
* @apiGroup users * @apiGroup users
* @apiName umeng__alias * @apiName umeng__alias
* *
* @apiParam {String} action
* - update: 更新(默认)
* - remove: 删除
* @apiParam {String} alias 别名 * @apiParam {String} alias 别名
* *
* @apiSuccess {Number} ret 返回状态码1正确、0错误 * @apiSuccess {Number} ret 返回状态码1正确、0错误
@ -1130,6 +1133,13 @@ class UsersController extends AbstractController
'alias.between:2,20' => '别名的长度在2-20个字符', 'alias.between:2,20' => '别名的长度在2-20个字符',
]); ]);
// //
if ($data['action'] === 'remove') {
if ($data['alias']) {
UmengAlias::whereAlias($data['alias'])->delete();
}
return Base::retSuccess('删除成功');
}
//
if (!in_array(Base::platform(), ['ios', 'android'])) { if (!in_array(Base::platform(), ['ios', 'android'])) {
return Base::retError('设备类型错误'); return Base::retError('设备类型错误');
} }

View File

@ -122,7 +122,9 @@ export default {
handler() { handler() {
this.$store.dispatch("websocketConnection"); this.$store.dispatch("websocketConnection");
// //
if (this.userId > 0 && this.$isEEUiApp) { if (this.$isEEUiApp) {
this.umengAliasTimer && clearTimeout(this.umengAliasTimer)
if (this.userId > 0) {
$A.eeuiAppSendMessage({ $A.eeuiAppSendMessage({
action: 'initApp', action: 'initApp',
apiUrl: $A.apiUrl(''), apiUrl: $A.apiUrl(''),
@ -130,12 +132,19 @@ export default {
token: this.userToken, token: this.userToken,
userAgent: window.navigator.userAgent, userAgent: window.navigator.userAgent,
}); });
setTimeout(_ => { this.umengAliasTimer = setTimeout(_ => {
this.umengAliasTimer = null;
$A.eeuiAppSendMessage({ $A.eeuiAppSendMessage({
action: 'setUmengAlias', action: 'setUmengAlias',
url: $A.apiUrl('users/umeng/alias') url: $A.apiUrl('users/umeng/alias')
}); });
}, 6000) }, 6000)
} else {
$A.eeuiAppSendMessage({
action: 'delUmengAlias',
url: $A.apiUrl('users/umeng/alias')
});
}
} }
}, },
immediate: true immediate: true

@ -1 +1 @@
Subproject commit 25571a072613453c181edb6a642fad8a3a053b12 Subproject commit 8533b26fe64824a3c714757aa7631f1da4413304