Commit 35d3a47f by Sixong.Zhu

cs

parent fee0ea0d
Showing with 13 additions and 10 deletions
import { UniplatSdk } from "uniplat-sdk";
import Chat from "../xim";
export type UserMapping = {
......@@ -12,22 +13,24 @@ const userMapping: UserMapping = {};
export const getUserMapping = () => userMapping;
export async function getUserInfo(eid: string) {
export async function getUserInfo(eid: string, sdk?: UniplatSdk) {
if (userMapping[eid]) {
return userMapping[eid];
}
if (!+eid) {
return { name: '', phone: '', icon: '' };
}
const info = await Chat.getSdk().domainService('passport', 'anonymous', `oidc.account/user_info?id=${eid}`).request<any, any, {
avatar_url: string;
email: string;
id: string;
mobile: string;
realname: string;
uniplatId: string;
username: string;
}>('get');
const info = await (sdk || Chat.getSdk())
.domainService('passport', 'anonymous', `oidc.account/user_info?id=${eid}`)
.request<any, any, {
avatar_url: string;
email: string;
id: string;
mobile: string;
realname: string;
uniplatId: string;
username: string;
}>('get');
const data = {
name: info.username || info.realname || info.mobile || info.mobile,
phone: info.mobile,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment