统一推送数据库表

This commit is contained in:
not-like-juvenile
2026-02-24 11:28:13 +08:00
parent 9a41b1c17f
commit 1ad4d05ffb
10 changed files with 818 additions and 0 deletions

View File

@@ -141,6 +141,7 @@
<script setup lang="uts">
import { ref, onMounted } from 'vue'
import supa from '@/components/supadb/aksupainstance.uts'
import { AkReq } from '@/uni_modules/ak-req/index.uts'
import { IS_TEST_MODE } from '@/ak/config.uts'
import { getCurrentUser, logout, setIsLoggedIn, setUserProfile } from '@/utils/store.uts'
import { UserProfile } from '@/pages/user/types.uts'
@@ -348,6 +349,35 @@ const handleLogin = async () => {
if (uid != null) {
uni.setStorageSync('user_id', uid)
console.log('用户ID已保存到本地存储:', uid)
// 获取并上报推送 CID若可用
try {
uni.getPushClientId({
success: async (res: any) => {
const cid = (res && (res.clientid || res.cid)) ? (res.clientid || res.cid) : (typeof res === 'string' ? res : null)
if (cid != null && cid !== '') {
try {
uni.setStorageSync('uni_push2_cid', cid)
} catch (e) {}
try {
await AkReq.request({
url: '/api/v1/push/register',
method: 'POST',
data: { cid, platform: 'android' },
contentType: 'application/json'
})
console.log('CID 已上报后台:', cid)
} catch (e) {
console.warn('上报 CID 失败:', e)
}
}
},
fail: (err: any) => {
console.warn('获取 Push CID 失败:', err)
}
})
} catch (e) {
console.warn('getPushClientId 调用异常:', e)
}
}
}