hejianhao
2026-08-28 16a57a8fc6868cea9171a1119698572407a2fc03
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/**
 * 读取当前缓存中的 APP 用户标识。
 */
export function resolveCurrentAppUserId() {
    const cachedUser = uni.getStorageSync('appUserInfo')
    if (!cachedUser || typeof cachedUser !== 'object') {
        return 0
    }
    const userId = Number(cachedUser.id || 0)
    if (!Number.isFinite(userId) || userId <= 0) {
        return 0
    }
    return userId
}