feat(fulfillment): 新增直播账号履约工作台

This commit is contained in:
yml
2026-11-17 14:44:28 +08:00
parent f8a35ec224
commit 1ca768eba5
30 changed files with 3729 additions and 27 deletions
+1
View File
@@ -12,6 +12,7 @@ export { douyuCollabApi } from './douyuCollab';
export { fileApi } from './files';
export { huyaApi } from './huya';
export { loginApi } from './login';
export { platformFulfillmentApi } from './platformFulfillment';
export { proxyApi } from './proxy';
export { userApi } from './users';
export { weiboApi } from './weibo';
@@ -0,0 +1,84 @@
import api from './client';
import type {
PlatformFulfillmentDetail,
PlatformFulfillmentListResponse,
PlatformFulfillmentMapping,
} from './types';
export const platformFulfillmentApi = {
listTasks: (params: {
status?: string;
keyword?: string;
page?: number;
page_size?: number;
}) =>
api.get<PlatformFulfillmentListResponse, PlatformFulfillmentListResponse>(
'/platform-fulfillment/tasks',
{ params },
),
sync: (limit = 100) =>
api.post<{ fetched: number; created: number; updated: number }, { fetched: number; created: number; updated: number }>(
'/platform-fulfillment/sync',
null,
{ params: { limit } },
),
getTask: (taskId: number) =>
api.get<PlatformFulfillmentDetail, PlatformFulfillmentDetail>(
`/platform-fulfillment/tasks/${taskId}`,
),
listMappings: (keyword = '') =>
api.get<PlatformFulfillmentMapping[], PlatformFulfillmentMapping[]>(
'/platform-fulfillment/mappings',
{ params: { keyword } },
),
upsertMapping: (data: {
internal_sku_key: string;
commodity_id: string;
goods_name?: string;
required_points?: number | null;
enabled: boolean;
}) =>
api.put<PlatformFulfillmentMapping, PlatformFulfillmentMapping>(
'/platform-fulfillment/mappings',
data,
),
allocate: (taskId: number) =>
api.post<PlatformFulfillmentDetail, PlatformFulfillmentDetail>(
`/platform-fulfillment/tasks/${taskId}/allocate`,
),
startBinding: (taskId: number) =>
api.post<PlatformFulfillmentDetail, PlatformFulfillmentDetail>(
`/platform-fulfillment/tasks/${taskId}/bind/start`,
),
refreshBinding: (taskId: number) =>
api.post<PlatformFulfillmentDetail, PlatformFulfillmentDetail>(
`/platform-fulfillment/tasks/${taskId}/bind/refresh`,
),
confirmBinding: (taskId: number) =>
api.post<PlatformFulfillmentDetail, PlatformFulfillmentDetail>(
`/platform-fulfillment/tasks/${taskId}/bind/confirm`,
),
refreshEligibility: (taskId: number) =>
api.post<PlatformFulfillmentDetail, PlatformFulfillmentDetail>(
`/platform-fulfillment/tasks/${taskId}/eligibility/refresh`,
),
complete: (taskId: number, note = '') =>
api.post<PlatformFulfillmentDetail, PlatformFulfillmentDetail>(
`/platform-fulfillment/tasks/${taskId}/complete`,
{ note },
),
release: (taskId: number) =>
api.post<PlatformFulfillmentDetail, PlatformFulfillmentDetail>(
`/platform-fulfillment/tasks/${taskId}/release`,
),
markManual: (taskId: number, reason = '') =>
api.post<PlatformFulfillmentDetail, PlatformFulfillmentDetail>(
`/platform-fulfillment/tasks/${taskId}/manual`,
{ reason },
),
cancel: (taskId: number, reason = '') =>
api.post<PlatformFulfillmentDetail, PlatformFulfillmentDetail>(
`/platform-fulfillment/tasks/${taskId}/cancel`,
{ reason },
),
};
+93
View File
@@ -2103,3 +2103,96 @@ export interface HuyaCollabGiftCatalogUpdate {
is_active?: boolean;
remark?: string;
}
export interface PlatformFulfillmentAccount {
id: number;
username: string;
nickname: string;
points: number | null;
goldBalance: number | null;
eliteOpened: boolean | null;
ckCheckStatus: string;
roleBindStatus: string;
gameName: string;
gameChannel: string;
roleChangeAvailableAt: string | null;
}
export interface PlatformFulfillmentBindTask {
id: number;
taskType: string;
status: string;
message: string;
qrUrl: string;
roleName: string;
areaName: string;
platName: string;
bindPhase: string;
bindReadyForConfirm: boolean;
bindConfirmed: boolean;
}
export interface PlatformFulfillmentTask {
id: number;
sourceSystem: string;
sourceOrderId: string;
sourceOrderItemId: string;
sourceFulfillmentId: string;
platformOrderId: string;
provider: string;
shopId: string;
shopName: string;
skuCode: string;
skuName: string;
internalSkuKey: string;
quantity: number;
orderAmountFen: number;
targetPlatform: string;
scope: string;
commodityMappingId: number | null;
commodityId: string;
requiredPoints: number | null;
bindingStatus: string;
executionStatus: string;
exchangeStatus: string;
issueCode: string;
lastError: string;
operatorId: number | null;
completedAt: string | null;
createdAt: string;
updatedAt: string;
account: PlatformFulfillmentAccount | null;
lease: { id: number; status: string; expiresAt: string } | null;
bindTask: PlatformFulfillmentBindTask | null;
}
export interface PlatformFulfillmentEvent {
id: number;
eventType: string;
actorType: string;
actorId: string;
detail: Record<string, unknown>;
createdAt: string;
}
export interface PlatformFulfillmentDetail {
task: PlatformFulfillmentTask;
events: PlatformFulfillmentEvent[];
}
export interface PlatformFulfillmentMapping {
id: number;
targetPlatform: string;
internalSkuKey: string;
commodityId: string;
goodsName: string;
requiredPoints: number | null;
scope: string;
enabled: boolean;
updatedAt: string;
}
export interface PlatformFulfillmentListResponse {
items: PlatformFulfillmentTask[];
pagination: { page: number; pageSize: number; total: number };
}