merge master into codex/wechat-mini-program-virtual-payment
This commit is contained in:
@@ -4,19 +4,18 @@ export type AuthLoginMethod = 'password' | 'phone' | 'wechat';
|
||||
export type AuthUser = {
|
||||
id: string;
|
||||
publicUserCode: string;
|
||||
username: string;
|
||||
displayName: string;
|
||||
avatarUrl: string | null;
|
||||
phoneNumberMasked: string | null;
|
||||
loginMethod: AuthLoginMethod;
|
||||
bindingStatus: AuthBindingStatus;
|
||||
wechatBound: boolean;
|
||||
createdAt: string;
|
||||
};
|
||||
|
||||
export type PublicUserSummary = {
|
||||
id: string;
|
||||
publicUserCode: string;
|
||||
username: string;
|
||||
displayName: string;
|
||||
avatarUrl: string | null;
|
||||
};
|
||||
@@ -159,14 +158,7 @@ export type AuthSessionSummary = {
|
||||
sessionId: string;
|
||||
sessionIds: string[];
|
||||
sessionCount: number;
|
||||
clientType: string;
|
||||
clientRuntime: string;
|
||||
clientPlatform: string;
|
||||
clientLabel: string;
|
||||
deviceDisplayName: string;
|
||||
miniProgramAppId: string | null;
|
||||
miniProgramEnv: string | null;
|
||||
userAgent: string | null;
|
||||
ipMasked: string | null;
|
||||
isCurrent: boolean;
|
||||
createdAt: string;
|
||||
|
||||
@@ -227,3 +227,31 @@ export function parseApiErrorMessage(rawText: string, fallbackMessage: string) {
|
||||
|
||||
return rawText.trim() || fallbackMessage;
|
||||
}
|
||||
|
||||
export function appendApiErrorRequestId(
|
||||
message: string,
|
||||
requestId: string | null | undefined,
|
||||
) {
|
||||
const trimmedMessage = message.trim() || '请求失败';
|
||||
const trimmedRequestId =
|
||||
typeof requestId === 'string' && requestId.trim()
|
||||
? requestId.trim()
|
||||
: '';
|
||||
|
||||
if (!trimmedRequestId || trimmedMessage.includes(trimmedRequestId)) {
|
||||
return trimmedMessage;
|
||||
}
|
||||
|
||||
return `${trimmedMessage}(requestId: ${trimmedRequestId})`;
|
||||
}
|
||||
|
||||
export function parseApiErrorMessageWithRequestId(
|
||||
rawText: string,
|
||||
fallbackMessage: string,
|
||||
requestId: string | null | undefined,
|
||||
) {
|
||||
return appendApiErrorRequestId(
|
||||
parseApiErrorMessage(rawText, fallbackMessage),
|
||||
requestId,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user