2025-07-22 22:52:55 +08:00
|
|
|
import { request } from '@umijs/max';
|
2025-07-25 20:25:28 +08:00
|
|
|
import { StoryItem, StoryType } from './data.d';
|
2025-07-22 22:52:55 +08:00
|
|
|
|
|
|
|
|
type ParamsType = {
|
|
|
|
|
count?: number;
|
|
|
|
|
instanceId?: string;
|
2025-07-25 20:25:28 +08:00
|
|
|
storyName?: string;
|
2025-07-22 22:52:55 +08:00
|
|
|
} & Partial<StoryType>;
|
|
|
|
|
|
|
|
|
|
export async function queryTimelineList(
|
|
|
|
|
params: ParamsType,
|
2025-07-25 20:25:28 +08:00
|
|
|
): Promise<{ data: StoryType[] }> {
|
2025-07-22 22:52:55 +08:00
|
|
|
return await request('/story/owner/test11', {
|
2025-07-25 20:25:28 +08:00
|
|
|
params,
|
2025-07-22 22:52:55 +08:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-25 20:25:28 +08:00
|
|
|
export async function deleteStory(params: ParamsType): Promise<{ data: { list: StoryType[] } }> {
|
2025-07-22 22:52:55 +08:00
|
|
|
return request(`/story/${params.instanceId}`, {
|
|
|
|
|
method: 'DELETE',
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-25 20:25:28 +08:00
|
|
|
export async function addStory(params: ParamsType): Promise<{ data: { list: StoryType[] } }> {
|
2025-07-22 22:52:55 +08:00
|
|
|
return request('/story/add', {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
data: {
|
|
|
|
|
...params,
|
|
|
|
|
method: 'post',
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
2025-07-25 20:25:28 +08:00
|
|
|
|
|
|
|
|
export async function updateStory(params: ParamsType): Promise<{ data: { list: StoryType[] } }> {
|
2025-07-22 22:52:55 +08:00
|
|
|
return await request(`/story/${params.instanceId}`, {
|
|
|
|
|
method: 'PUT',
|
|
|
|
|
data: {
|
|
|
|
|
...params,
|
|
|
|
|
method: 'put',
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-25 20:25:28 +08:00
|
|
|
export async function addStoryItem(params: FormData): Promise<any> {
|
2025-07-22 22:52:55 +08:00
|
|
|
return request(`/story/item`, {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
data: params,
|
|
|
|
|
requestType: 'form',
|
|
|
|
|
getResponse: true,
|
|
|
|
|
});
|
|
|
|
|
}
|
2025-07-25 20:25:28 +08:00
|
|
|
|
|
|
|
|
export async function queryStoryItem(masterItemId: string): Promise<{ data: StoryItem[] }> {
|
2025-07-22 22:52:55 +08:00
|
|
|
return request(`/story/item/list`, {
|
|
|
|
|
method: 'GET',
|
|
|
|
|
params: {
|
|
|
|
|
masterItemId,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
2025-07-25 20:25:28 +08:00
|
|
|
|
|
|
|
|
export async function queryStoryItemDetail(itemId: string): Promise<{ data: StoryItem[] }> {
|
2025-07-22 22:52:55 +08:00
|
|
|
return request(`/story/item/${itemId}`, {
|
|
|
|
|
method: 'GET',
|
|
|
|
|
});
|
|
|
|
|
}
|
2025-07-25 20:25:28 +08:00
|
|
|
|
|
|
|
|
export async function queryStoryItemImages(itemId: string): Promise<{ data: string[] }> {
|
2025-07-22 22:52:55 +08:00
|
|
|
return request(`/story/item/images/${itemId}`, {
|
|
|
|
|
method: 'GET',
|
|
|
|
|
});
|
|
|
|
|
}
|
2025-07-25 20:25:28 +08:00
|
|
|
|
|
|
|
|
export async function fetchImage(imageInstanceId: string): Promise<any> {
|
2025-07-22 22:52:55 +08:00
|
|
|
return request(`/file/download/cover/${imageInstanceId}`, {
|
|
|
|
|
method: 'GET',
|
|
|
|
|
responseType: 'blob',
|
|
|
|
|
getResponse: true,
|
2025-07-25 20:25:28 +08:00
|
|
|
});
|
2025-07-22 22:52:55 +08:00
|
|
|
}
|