feat(M08-D): 补广告与装修管理

This commit is contained in:
Codex
2026-08-10 12:57:05 +08:00
parent ec4219ae31
commit c1c02421a1
17 changed files with 913 additions and 21 deletions
+64
View File
@@ -1,10 +1,14 @@
import type {
Advertisement,
AdvertisementInput,
CleaningSettlement,
CleaningSettlementDetail,
CleaningStatistics,
CleaningTask,
CleaningTaskEvent,
CleaningTaskMember,
DecorationComponent,
DecorationVersion,
DeviceTopology,
DeviceType,
BusinessStatistics,
@@ -14,6 +18,7 @@ import type {
ManagedOrder,
ManagedStore,
ManagedUser,
MediaAsset,
PageResult,
OrderAction,
OrderHistoryItem,
@@ -435,6 +440,65 @@ export function bindPlatformApplication(session: ApiSession, input: {
return request<{ platformAppId: string; bound: boolean }>(session, '/platform-apps/bind', { method: 'POST', body: JSON.stringify(input) });
}
export function listMediaAssets(session: ApiSession, storeId?: string) {
const query = storeId ? `?${new URLSearchParams({ storeId })}` : '';
return request<MediaAsset[]>(session, `/media/images${query}`);
}
export async function uploadMediaImage(session: ApiSession, file: File, storeId?: string) {
const headers = new Headers({
'content-type': 'application/octet-stream',
'x-image-content-type': file.type,
'x-file-name': file.name.replace(/[^\x20-\x7e]/g, '_') || 'image'
});
if (storeId) headers.set('x-store-id', storeId);
return request<{ assetId: string; url: string }>(session, '/media/images', {
method: 'POST', headers, body: await file.arrayBuffer()
});
}
export function listDecorations(session: ApiSession, storeId: string) {
return request<DecorationVersion[]>(
session, `/decorations?${new URLSearchParams({ storeId })}`
);
}
export function saveDecoration(session: ApiSession, input: {
storeId: string; templateCode: string; schemaVersion: number;
content: { components: DecorationComponent[] };
}) {
return request<{ decorationId: string; version: number }>(session, '/decorations', {
method: 'POST', body: JSON.stringify(input)
});
}
export function publishDecoration(session: ApiSession, decorationId: string, storeId: string) {
return request<{ decorationId: string; published: boolean }>(
session,
`/decorations/${encodeURIComponent(decorationId)}/publish?${new URLSearchParams({ storeId })}`,
{ method: 'POST' }
);
}
export function listAdvertisements(session: ApiSession) {
return request<Advertisement[]>(session, '/advertisements');
}
export function saveAdvertisement(session: ApiSession, input: AdvertisementInput) {
return request<{ advertisementId: string }>(session, '/advertisements', {
method: 'POST', body: JSON.stringify(input)
});
}
export function updateAdvertisement(
session: ApiSession, advertisementId: string, input: AdvertisementInput
) {
return request<{ advertisementId: string }>(
session, `/advertisements/${encodeURIComponent(advertisementId)}`,
{ method: 'PUT', body: JSON.stringify(input) }
);
}
export function createStaffUser(
session: ApiSession,
input: { nickname: string; phone: string; note?: string; roles: StaffRole[]; storeIds: string[] }