浏览 SDKs · uni-app / uni-app x
SDKsuni-app

查询未处理好友申请数

查询好友申请入口的未处理数量。

复制

getFriendApplicationUnhandledCount() 返回未处理好友申请数量,结果可能为 null

import { getFriendApplicationUnhandledCount } from '@/uni_modules/unix-openim-sdk'

const count = await getFriendApplicationUnhandledCount({ offset: 0, count: 100 })
renderApplicationBadge(count ?? 0)

分页参数用于限制本次统计查询范围,实际产品应使用与服务端约定一致的 count。不要把 null 永久缓存成 0;它也可能表示当前没有有效结果。

申请新增、接受、拒绝或删除时重新查询数量,避免在多个设备和断线恢复场景下只做本地 +1/-1 而漂移。