39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
import { http } from './http';
|
|
|
|
export const amazonApi = {
|
|
// 上传Excel文件解析ASIN列表
|
|
importAsinFromExcel(file: File) {
|
|
const formData = new FormData();
|
|
formData.append('file', file);
|
|
return http.upload<{ code: number, data: { asinList: string[], total: number }, msg: string | null }>('/api/amazon/import/asin', formData);
|
|
},
|
|
|
|
getProductsBatch(asinList: string[], batchId: string) {
|
|
return http.post<{ code: number, data: { products: any[] }, msg: string | null }>('/api/amazon/products/batch', { asinList, batchId });
|
|
},
|
|
getLatestProducts() {
|
|
return http.get<{ code: number, data: { products: any[] }, msg: string | null }>('/api/amazon/products/latest');
|
|
},
|
|
getProductsByBatch(batchId: string) {
|
|
return http.get<{ products: any[] }>(`/api/amazon/products/batch/${batchId}`);
|
|
},
|
|
updateProduct(productData: unknown) {
|
|
return http.post('/api/amazon/products/update', productData);
|
|
},
|
|
deleteProduct(productId: string) {
|
|
return http.post('/api/amazon/products/delete', { id: productId });
|
|
},
|
|
exportToExcel(products: unknown[], options: Record<string, unknown> = {}) {
|
|
return http.post('/api/amazon/export', { products, ...options });
|
|
},
|
|
getProductStats() {
|
|
return http.get('/api/amazon/stats');
|
|
},
|
|
searchProducts(searchParams: Record<string, unknown>) {
|
|
return http.get('/api/amazon/products/search', searchParams);
|
|
},
|
|
openGenmaiSpirit() {
|
|
return http.post('/api/genmai/open');
|
|
},
|
|
};
|