diff --git a/src/pages/Organiza/User/index.tsx b/src/pages/Organiza/User/index.tsx index d128618..ec80285 100644 --- a/src/pages/Organiza/User/index.tsx +++ b/src/pages/Organiza/User/index.tsx @@ -28,6 +28,12 @@ const ListPage: React.FC = () => { dataIndex: 'username', sorter: true, }, + { + title: '邮箱', + dataIndex: 'email', + sorter: true, + ellipsis: true, + }, { title: '超管', @@ -105,6 +111,7 @@ const ListPage: React.FC = () => { current = 1, pageSize = 10, username, + email, isActive, isSuper, remark, @@ -112,6 +119,8 @@ const ListPage: React.FC = () => { console.log(`params`, params, sort); const qp: any = { current, pageSize }; if (username) qp.username = username; + // 条件判断 透传邮箱查询参数 + if (email) qp.email = email; if (typeof isActive !== 'undefined' && isActive !== '') qp.isActive = String(isActive); if (typeof isSuper !== 'undefined' && isSuper !== '') @@ -190,6 +199,13 @@ const CreateForm: React.FC<{ placeholder="请输入用户名" rules={[{ required: true, message: '请输入用户名' }]} /> + 编辑} initialValues={{ username: record.username, + email: record.email, isSuper: record.isSuper, isAdmin: record.isAdmin, remark: record.remark, @@ -250,6 +267,13 @@ const EditForm: React.FC<{ placeholder="请输入用户名" rules={[{ required: true, message: '请输入用户名' }]} /> + { if (!values.siteId) return false; try { - await wpproductcontrollerBatchSyncToSite( + await wpproductcontrollerBatchsynctosite( { siteId: values.siteId }, { productIds } ); @@ -295,7 +295,7 @@ const WpProductInfo: React.FC<{ skus: string[]; record: API.Product; parentTable key="syncToSite" onClick={async () => { try { - await wpproductcontrollerBatchSyncToSite( + await wpproductcontrollerBatchsynctosite( { siteId: wpRow.siteId }, { productIds: [record.id] }, ); @@ -312,7 +312,7 @@ const WpProductInfo: React.FC<{ skus: string[]; record: API.Product; parentTable key="syncToProduct" onClick={async () => { try { - await wpproductcontrollerSyncToProduct({ id: wpRow.id }); + await wpproductcontrollerSynctoproduct({ id: wpRow.id }); message.success('同步进商品成功'); parentTableRef.current?.reload(); } catch (e: any) { diff --git a/src/pages/Site/List/index.tsx b/src/pages/Site/List/index.tsx index e138ac1..36ab559 100644 --- a/src/pages/Site/List/index.tsx +++ b/src/pages/Site/List/index.tsx @@ -227,6 +227,7 @@ const SiteList: React.FC = () => { title: '操作', dataIndex: 'actions', width: 240, + fixed:"right", hideInSearch: true, render: (_, row) => ( @@ -380,6 +381,7 @@ const SiteList: React.FC = () => { return ( <> + scroll={{ x: 'max-content' }} actionRef={actionRef} rowKey="id" columns={columns} diff --git a/src/pages/Site/Shop/Customers/index.tsx b/src/pages/Site/Shop/Customers/index.tsx index e3148ca..96c7297 100644 --- a/src/pages/Site/Shop/Customers/index.tsx +++ b/src/pages/Site/Shop/Customers/index.tsx @@ -1,4 +1,4 @@ -import { ActionType, DrawerForm, ModalForm, PageContainer, ProColumns, ProFormText, ProTable } from '@ant-design/pro-components'; +import { ActionType, DrawerForm, ModalForm, PageContainer, ProColumns, ProFormText, ProFormTextArea, ProTable } from '@ant-design/pro-components'; import { request, useParams } from '@umijs/max'; import { App, Avatar, Button, Popconfirm, Space, Tag } from 'antd'; import React, { useRef, useState } from 'react'; @@ -51,6 +51,7 @@ const BatchEditCustomers: React.FC<{ }} > + ); }; @@ -110,6 +111,12 @@ const CustomerPage: React.FC = () => { dataIndex: 'email', copyable: true, }, + { + title: '电话', + dataIndex: 'phone', + render: (_, record) => record.phone || record.billing?.phone || record.shipping?.phone || '-', + copyable: true, + }, { title: '角色', dataIndex: 'role', @@ -217,6 +224,7 @@ const CustomerPage: React.FC = () => { + , { setSelectedRowKeys={setSelectedRowKeys} siteId={siteId} />, + , + 批量导入} + width={600} + modalProps={{ destroyOnHidden: true }} + onFinish={async (values) => { + if (!siteId) return false; + const csv = values.csv || ''; + const items = values.items || []; + const res = await request(`/site-api/${siteId}/customers/import`, { method: 'POST', data: { csv, items } }); + if (res.success) { + message.success('导入完成'); + actionRef.current?.reload(); + return true; + } + message.error(res.message || '导入失败'); + return false; + }} + > + + , + - { @@ -239,20 +239,59 @@ const OrdersPage: React.FC = () => { disabled={!selectedRowKeys.length} onClick={async () => { if (!siteId) return; - let ok = 0, fail = 0; - for (const id of selectedRowKeys) { - const res = await request(`/site-api/${siteId}/orders/${id}`, { method: 'DELETE' }); - if (res.success) ok++; else fail++; - } + const res = await request(`/site-api/${siteId}/orders/batch`, { + method: 'POST', + data: { delete: selectedRowKeys }, + }); setSelectedRowKeys([]); actionRef.current?.reload(); - if (fail) { - message.warning(`成功 ${ok}, 失败 ${fail}`); + if (res.success) { + message.success('批量删除成功'); } else { - message.success(`成功删除 ${ok} 条`); + message.warning(res.message || '部分删除失败'); } }} /> + , + , + 批量导入} + width={600} + modalProps={{ destroyOnHidden: true }} + onFinish={async (values) => { + if (!siteId) return false; + const csv = values.csv || ''; + const items = values.items || []; + const res = await request(`/site-api/${siteId}/orders/import`, { method: 'POST', data: { csv, items } }); + if (res.success) { + message.success('导入完成'); + actionRef.current?.reload(); + return true; + } + message.error(res.message || '导入失败'); + return false; + }} + > + + + ]} request={async ({ date, ...param }: any) => { if (param.status === 'all') { diff --git a/src/pages/Site/Shop/Products/index.tsx b/src/pages/Site/Shop/Products/index.tsx index 7c419b7..6a33aec 100644 --- a/src/pages/Site/Shop/Products/index.tsx +++ b/src/pages/Site/Shop/Products/index.tsx @@ -172,48 +172,7 @@ const ProductsPage: React.FC = () => { }, ]; - const varColumns: ProColumns[] = [ - { - title: '变体名', - dataIndex: 'name', - }, - { - title: 'sku', - dataIndex: 'sku', - }, - { - title: '常规价格', - dataIndex: 'regular_price', - hideInSearch: true, - }, - { - title: '销售价格', - dataIndex: 'sale_price', - hideInSearch: true, - }, - { - title: '操作', - dataIndex: 'option', - valueType: 'option', - render: (_, record) => ( - <> - - {record.sku ? ( - <> - - - - ) : ( - <> - )} - - ), - }, - ]; + const varColumns: ProColumns[] = []; return ( @@ -269,26 +228,67 @@ const ProductsPage: React.FC = () => { setSelectedRowKeys={setSelectedRowKeys} selectedRows={selectedRows} config={config} + siteId={siteId} />, , , + , ]} expandable={{ rowExpandable: (record) => record.type === 'variable', - expandedRowRender: (record) => ( - - rowKey="id" - dataSource={record.variations} - pagination={false} - search={false} - options={false} - columns={varColumns} - /> - ), + expandedRowRender: (record) => { + const productExternalId = record.externalProductId || record.external_product_id || record.id; + const innerColumns: ProColumns[] = [ + { title: '变体名', dataIndex: 'name' }, + { title: 'sku', dataIndex: 'sku' }, + { title: '常规价格', dataIndex: 'regular_price', hideInSearch: true }, + { title: '销售价格', dataIndex: 'sale_price', hideInSearch: true }, + { + title: '操作', + dataIndex: 'option', + valueType: 'option', + render: (_, row) => ( + <> + + {row.sku ? ( + <> + + + + ) : ( + <> + )} + + ), + }, + ]; + return ( + + rowKey="id" + dataSource={record.variations} + pagination={false} + search={false} + options={false} + columns={innerColumns} + /> + ); + }, }} /> diff --git a/src/pages/Site/Shop/Subscriptions/index.tsx b/src/pages/Site/Shop/Subscriptions/index.tsx index 05c86d8..e8b4aff 100644 --- a/src/pages/Site/Shop/Subscriptions/index.tsx +++ b/src/pages/Site/Shop/Subscriptions/index.tsx @@ -159,10 +159,26 @@ const SubscriptionsPage: React.FC = () => { toolBarRender={() => [ } + width={600} + modalProps={{ destroyOnHidden: true }} + onFinish={async (values) => { + if (!siteId) return false; + const updatePayload = selectedRows.map((row) => ({ id: row.id, ...values })); + try { + const res = await request(`/site-api/${siteId}/products/batch`, { method: 'POST', data: { update: updatePayload } }); + if (res.success) { + message.success('批量编辑成功'); + tableRef.current?.reload(); + setSelectedRowKeys([]); + return true; + } + message.error(res.message || '批量编辑失败'); + return false; + } catch (e: any) { + message.error(e.message || '批量编辑失败'); + return false; + } + }} + > + + + + + + + ); +}; + // Disable for now export const SetComponent: React.FC = () => null; // Disable for now (relies on local productcontrollerProductbysku?) -export const ImportCsv: React.FC = () => null; // Disable for now + +export const ImportCsv: React.FC<{ + tableRef: React.MutableRefObject; + siteId?: string; +}> = ({ tableRef, siteId }) => { + const { message } = App.useApp(); + return ( + }>批量导入} + width={600} + modalProps={{ destroyOnHidden: true }} + onFinish={async (values) => { + if (!siteId) return false; + const csvText = values.csv || ''; + const itemsList = values.items || []; + try { + const res = await request(`/site-api/${siteId}/products/import`, { method: 'POST', data: { csv: csvText, items: itemsList } }); + if (res.success) { + message.success('导入完成'); + tableRef.current?.reload(); + return true; + } + message.error(res.message || '导入失败'); + return false; + } catch (e: any) { + message.error(e.message || '导入失败'); + return false; + } + }} + > + + + + + + + + + + + ); +}; + // Disable for now diff --git a/src/pages/Woo/Product/List/index.tsx b/src/pages/Woo/Product/List/index.tsx index afcfc9c..bd0638c 100644 --- a/src/pages/Woo/Product/List/index.tsx +++ b/src/pages/Woo/Product/List/index.tsx @@ -5,9 +5,9 @@ import { } from '@/servers/api/product'; import { sitecontrollerAll } from '@/servers/api/site'; import { - wpproductcontrollerBatchUpdateProducts, + wpproductcontrollerBatchupdateproducts, wpproductcontrollerGetwpproducts, - wpproductcontrollerImportProducts, + wpproductcontrollerImportproducts, wpproductcontrollerSetconstitution, wpproductcontrollerSyncproducts, wpproductcontrollerUpdateproduct, @@ -1043,7 +1043,7 @@ const BatchEditProducts: React.FC<{ try { const ids = selectedRowKeys.map((key) => Number(key)); const { success, message: errMsg } = - await wpproductcontrollerBatchUpdateProducts({ + await wpproductcontrollerBatchupdateproducts({ ids, ...values, }); @@ -1126,7 +1126,7 @@ const ImportCsv: React.FC<{ const formData = new FormData(); formData.append('file', values.file[0].originFileObj); - const { success, message: errMsg } = await wpproductcontrollerImportProducts( + const { success, message: errMsg } = await wpproductcontrollerImportproducts( { siteId: values.siteId }, formData ); diff --git a/src/servers/api/customer.ts b/src/servers/api/customer.ts index de2d398..de753f9 100644 --- a/src/servers/api/customer.ts +++ b/src/servers/api/customer.ts @@ -2,42 +2,12 @@ /* eslint-disable */ import { request } from 'umi'; -/** 此处后端没有提供注释 GET /customer/list */ -export async function customercontrollerGetcustomerlist( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.customercontrollerGetcustomerlistParams, - options?: { [key: string]: any }, -) { - return request('/customer/list', { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 此处后端没有提供注释 PUT /customer/rate */ -export async function customercontrollerSetrate( - body: Record, - options?: { [key: string]: any }, -) { - return request('/customer/rate', { - method: 'PUT', - headers: { - 'Content-Type': 'text/plain', - }, - data: body, - ...(options || {}), - }); -} - -/** 此处后端没有提供注释 POST /customer/tag/add */ +/** 此处后端没有提供注释 POST /customer/addtag */ export async function customercontrollerAddtag( body: API.CustomerTagDTO, options?: { [key: string]: any }, ) { - return request('/customer/tag/add', { + return request>('/customer/addtag', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -47,13 +17,13 @@ export async function customercontrollerAddtag( }); } -/** 此处后端没有提供注释 DELETE /customer/tag/del */ +/** 此处后端没有提供注释 POST /customer/deltag */ export async function customercontrollerDeltag( body: API.CustomerTagDTO, options?: { [key: string]: any }, ) { - return request('/customer/tag/del', { - method: 'DELETE', + return request>('/customer/deltag', { + method: 'POST', headers: { 'Content-Type': 'application/json', }, @@ -62,12 +32,42 @@ export async function customercontrollerDeltag( }); } -/** 此处后端没有提供注释 GET /customer/tags */ +/** 此处后端没有提供注释 GET /customer/getcustomerlist */ +export async function customercontrollerGetcustomerlist( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.customercontrollerGetcustomerlistParams, + options?: { [key: string]: any }, +) { + return request>('/customer/getcustomerlist', { + method: 'GET', + params: { + ...params, + }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 GET /customer/gettags */ export async function customercontrollerGettags(options?: { [key: string]: any; }) { - return request('/customer/tags', { + return request>('/customer/gettags', { method: 'GET', ...(options || {}), }); } + +/** 此处后端没有提供注释 POST /customer/setrate */ +export async function customercontrollerSetrate( + body: Record, + options?: { [key: string]: any }, +) { + return request>('/customer/setrate', { + method: 'POST', + headers: { + 'Content-Type': 'text/plain', + }, + data: body, + ...(options || {}), + }); +} diff --git a/src/servers/api/index.ts b/src/servers/api/index.ts index 94d01f9..c8db741 100644 --- a/src/servers/api/index.ts +++ b/src/servers/api/index.ts @@ -1,16 +1,18 @@ // @ts-ignore /* eslint-disable */ -// API 更新时间: -// API 唯一标识: +// API 更新时间: +// API 唯一标识: import * as area from './area'; import * as category from './category'; import * as customer from './customer'; import * as dict from './dict'; import * as locales from './locales'; import * as logistics from './logistics'; +import * as media from './media'; import * as order from './order'; import * as product from './product'; import * as site from './site'; +import * as siteApi from './siteApi'; import * as statistics from './statistics'; import * as stock from './stock'; import * as subscription from './subscription'; @@ -25,8 +27,10 @@ export default { dict, locales, logistics, + media, order, product, + siteApi, site, statistics, stock, diff --git a/src/servers/api/media.ts b/src/servers/api/media.ts new file mode 100644 index 0000000..f243526 --- /dev/null +++ b/src/servers/api/media.ts @@ -0,0 +1,92 @@ +// @ts-ignore +/* eslint-disable */ +import { request } from 'umi'; + +/** 此处后端没有提供注释 DELETE /media/${param0} */ +export async function mediacontrollerDelete( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.mediacontrollerDeleteParams, + options?: { [key: string]: any }, +) { + const { id: param0, ...queryParams } = params; + return request(`/media/${param0}`, { + method: 'DELETE', + params: { + ...queryParams, + }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 GET /media/list */ +export async function mediacontrollerList( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.mediacontrollerListParams, + options?: { [key: string]: any }, +) { + return request('/media/list', { + method: 'GET', + params: { + ...params, + }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 POST /media/update/${param0} */ +export async function mediacontrollerUpdate( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.mediacontrollerUpdateParams, + body: Record, + options?: { [key: string]: any }, +) { + const { id: param0, ...queryParams } = params; + return request(`/media/update/${param0}`, { + method: 'POST', + headers: { + 'Content-Type': 'text/plain', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 POST /media/upload */ +export async function mediacontrollerUpload( + body: {}, + files?: File[], + options?: { [key: string]: any }, +) { + const formData = new FormData(); + + if (files) { + files.forEach((f) => formData.append('files', f || '')); + } + + Object.keys(body).forEach((ele) => { + const item = (body as any)[ele]; + + if (item !== undefined && item !== null) { + if (typeof item === 'object' && !(item instanceof File)) { + if (item instanceof Array) { + item.forEach((f) => formData.append(ele, f || '')); + } else { + formData.append( + ele, + new Blob([JSON.stringify(item)], { type: 'application/json' }), + ); + } + } else { + formData.append(ele, item); + } + } + }); + + return request('/media/upload', { + method: 'POST', + data: formData, + requestType: 'form', + ...(options || {}), + }); +} diff --git a/src/servers/api/product.ts b/src/servers/api/product.ts index 4d535bb..2f3f2e9 100644 --- a/src/servers/api/product.ts +++ b/src/servers/api/product.ts @@ -36,36 +36,6 @@ export async function productcontrollerUpdateproduct( }); } -/** 此处后端没有提供注释 PUT /product/batch-update */ -export async function productcontrollerBatchupdateproduct( - body: API.BatchUpdateProductDTO, - options?: { [key: string]: any }, -) { - return request('/product/batch-update', { - method: 'PUT', - headers: { - 'Content-Type': 'application/json', - }, - data: body, - ...(options || {}), - }); -} - -/** 此处后端没有提供注释 POST /product/batch-delete */ -export async function productcontrollerBatchdeleteproduct( - body: { ids: number[] }, - options?: { [key: string]: any }, -) { - return request('/product/batch-delete', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - data: body, - ...(options || {}), - }); -} - /** 此处后端没有提供注释 DELETE /product/${param0} */ export async function productcontrollerDeleteproduct( // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) @@ -94,25 +64,6 @@ export async function productcontrollerGetproductcomponents( }); } -/** 此处后端没有提供注释 POST /product/${param0}/components */ -export async function productcontrollerSetproductcomponents( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.productcontrollerSetproductcomponentsParams, - body: API.SetProductComponentsDTO, - options?: { [key: string]: any }, -) { - const { id: param0, ...queryParams } = params; - return request(`/product/${param0}/components`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - params: { ...queryParams }, - data: body, - ...(options || {}), - }); -} - /** 此处后端没有提供注释 POST /product/${param0}/components/auto */ export async function productcontrollerAutobindcomponents( // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) @@ -127,6 +78,39 @@ export async function productcontrollerAutobindcomponents( }); } +/** 此处后端没有提供注释 GET /product/${param0}/site-skus */ +export async function productcontrollerGetproductsiteskus( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.productcontrollerGetproductsiteskusParams, + options?: { [key: string]: any }, +) { + const { id: param0, ...queryParams } = params; + return request(`/product/${param0}/site-skus`, { + method: 'GET', + params: { ...queryParams }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 POST /product/${param0}/site-skus */ +export async function productcontrollerBindproductsiteskus( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.productcontrollerBindproductsiteskusParams, + body: Record, + options?: { [key: string]: any }, +) { + const { id: param0, ...queryParams } = params; + return request(`/product/${param0}/site-skus`, { + method: 'POST', + headers: { + 'Content-Type': 'text/plain', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }); +} + /** 此处后端没有提供注释 GET /product/attribute */ export async function productcontrollerGetattributelist( // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) @@ -216,6 +200,36 @@ export async function productcontrollerGetattributeall( }); } +/** 此处后端没有提供注释 POST /product/batch-delete */ +export async function productcontrollerBatchdeleteproduct( + body: API.BatchDeleteProductDTO, + options?: { [key: string]: any }, +) { + return request('/product/batch-delete', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 PUT /product/batch-update */ +export async function productcontrollerBatchupdateproduct( + body: API.BatchUpdateProductDTO, + options?: { [key: string]: any }, +) { + return request('/product/batch-update', { + method: 'PUT', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + }); +} + /** 此处后端没有提供注释 POST /product/brand */ export async function productcontrollerCompatcreatebrand( body: Record, @@ -718,6 +732,16 @@ export async function productcontrollerCompatstrengthall(options?: { }); } +/** 此处后端没有提供注释 POST /product/sync-stock */ +export async function productcontrollerSyncstocktoproduct(options?: { + [key: string]: any; +}) { + return request('/product/sync-stock', { + method: 'POST', + ...(options || {}), + }); +} + /** 此处后端没有提供注释 GET /product/wp-products */ export async function productcontrollerGetwpproducts(options?: { [key: string]: any; diff --git a/src/servers/api/siteApi.ts b/src/servers/api/siteApi.ts new file mode 100644 index 0000000..37e486a --- /dev/null +++ b/src/servers/api/siteApi.ts @@ -0,0 +1,658 @@ +// @ts-ignore +/* eslint-disable */ +import { request } from 'umi'; + +/** 此处后端没有提供注释 GET /site-api/${param0}/customers */ +export async function siteapicontrollerGetcustomers( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerGetcustomersParams, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request( + `/site-api/${param0}/customers`, + { + method: 'GET', + params: { + ...queryParams, + }, + ...(options || {}), + }, + ); +} + +/** 此处后端没有提供注释 POST /site-api/${param0}/customers */ +export async function siteapicontrollerCreatecustomer( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerCreatecustomerParams, + body: API.UnifiedCustomerDTO, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request(`/site-api/${param0}/customers`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 POST /site-api/${param0}/customers/batch */ +export async function siteapicontrollerBatchcustomers( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerBatchcustomersParams, + body: Record, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request>(`/site-api/${param0}/customers/batch`, { + method: 'POST', + headers: { + 'Content-Type': 'text/plain', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 GET /site-api/${param0}/customers/export */ +export async function siteapicontrollerExportcustomers( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerExportcustomersParams, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request(`/site-api/${param0}/customers/export`, { + method: 'GET', + params: { + ...queryParams, + }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 POST /site-api/${param0}/customers/import */ +export async function siteapicontrollerImportcustomers( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerImportcustomersParams, + body: Record, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request>(`/site-api/${param0}/customers/import`, { + method: 'POST', + headers: { + 'Content-Type': 'text/plain', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 GET /site-api/${param0}/media */ +export async function siteapicontrollerGetmedia( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerGetmediaParams, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request(`/site-api/${param0}/media`, { + method: 'GET', + params: { + ...queryParams, + }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 POST /site-api/${param0}/media/batch */ +export async function siteapicontrollerBatchmedia( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerBatchmediaParams, + body: Record, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request>(`/site-api/${param0}/media/batch`, { + method: 'POST', + headers: { + 'Content-Type': 'text/plain', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 GET /site-api/${param0}/media/export */ +export async function siteapicontrollerExportmedia( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerExportmediaParams, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request(`/site-api/${param0}/media/export`, { + method: 'GET', + params: { + ...queryParams, + }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 GET /site-api/${param0}/orders */ +export async function siteapicontrollerGetorders( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerGetordersParams, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request(`/site-api/${param0}/orders`, { + method: 'GET', + params: { + ...queryParams, + }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 POST /site-api/${param0}/orders */ +export async function siteapicontrollerCreateorder( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerCreateorderParams, + body: Record, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request(`/site-api/${param0}/orders`, { + method: 'POST', + headers: { + 'Content-Type': 'text/plain', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 POST /site-api/${param0}/orders/batch */ +export async function siteapicontrollerBatchorders( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerBatchordersParams, + body: Record, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request>(`/site-api/${param0}/orders/batch`, { + method: 'POST', + headers: { + 'Content-Type': 'text/plain', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 GET /site-api/${param0}/orders/export */ +export async function siteapicontrollerExportorders( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerExportordersParams, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request(`/site-api/${param0}/orders/export`, { + method: 'GET', + params: { + ...queryParams, + }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 POST /site-api/${param0}/orders/import */ +export async function siteapicontrollerImportorders( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerImportordersParams, + body: Record, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request>(`/site-api/${param0}/orders/import`, { + method: 'POST', + headers: { + 'Content-Type': 'text/plain', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 GET /site-api/${param0}/products */ +export async function siteapicontrollerGetproducts( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerGetproductsParams, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request( + `/site-api/${param0}/products`, + { + method: 'GET', + params: { + ...queryParams, + }, + ...(options || {}), + }, + ); +} + +/** 此处后端没有提供注释 POST /site-api/${param0}/products */ +export async function siteapicontrollerCreateproduct( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerCreateproductParams, + body: API.UnifiedProductDTO, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request(`/site-api/${param0}/products`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 POST /site-api/${param0}/products/batch */ +export async function siteapicontrollerBatchproducts( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerBatchproductsParams, + body: Record, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request>(`/site-api/${param0}/products/batch`, { + method: 'POST', + headers: { + 'Content-Type': 'text/plain', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 GET /site-api/${param0}/products/export */ +export async function siteapicontrollerExportproducts( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerExportproductsParams, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request(`/site-api/${param0}/products/export`, { + method: 'GET', + params: { + ...queryParams, + }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 GET /site-api/${param0}/products/export-special */ +export async function siteapicontrollerExportproductsspecial( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerExportproductsspecialParams, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request(`/site-api/${param0}/products/export-special`, { + method: 'GET', + params: { + ...queryParams, + }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 POST /site-api/${param0}/products/import */ +export async function siteapicontrollerImportproducts( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerImportproductsParams, + body: Record, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request>(`/site-api/${param0}/products/import`, { + method: 'POST', + headers: { + 'Content-Type': 'text/plain', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 POST /site-api/${param0}/products/import-special */ +export async function siteapicontrollerImportproductsspecial( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerImportproductsspecialParams, + body: Record, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request>( + `/site-api/${param0}/products/import-special`, + { + method: 'POST', + headers: { + 'Content-Type': 'text/plain', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }, + ); +} + +/** 此处后端没有提供注释 GET /site-api/${param0}/subscriptions */ +export async function siteapicontrollerGetsubscriptions( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerGetsubscriptionsParams, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request( + `/site-api/${param0}/subscriptions`, + { + method: 'GET', + params: { + ...queryParams, + }, + ...(options || {}), + }, + ); +} + +/** 此处后端没有提供注释 GET /site-api/${param0}/subscriptions/export */ +export async function siteapicontrollerExportsubscriptions( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerExportsubscriptionsParams, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request(`/site-api/${param0}/subscriptions/export`, { + method: 'GET', + params: { + ...queryParams, + }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 GET /site-api/${param1}/customers/${param0} */ +export async function siteapicontrollerGetcustomer( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerGetcustomerParams, + options?: { [key: string]: any }, +) { + const { id: param0, siteId: param1, ...queryParams } = params; + return request( + `/site-api/${param1}/customers/${param0}`, + { + method: 'GET', + params: { ...queryParams }, + ...(options || {}), + }, + ); +} + +/** 此处后端没有提供注释 PUT /site-api/${param1}/customers/${param0} */ +export async function siteapicontrollerUpdatecustomer( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerUpdatecustomerParams, + body: API.UnifiedCustomerDTO, + options?: { [key: string]: any }, +) { + const { id: param0, siteId: param1, ...queryParams } = params; + return request( + `/site-api/${param1}/customers/${param0}`, + { + method: 'PUT', + headers: { + 'Content-Type': 'application/json', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }, + ); +} + +/** 此处后端没有提供注释 DELETE /site-api/${param1}/customers/${param0} */ +export async function siteapicontrollerDeletecustomer( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerDeletecustomerParams, + options?: { [key: string]: any }, +) { + const { id: param0, siteId: param1, ...queryParams } = params; + return request>( + `/site-api/${param1}/customers/${param0}`, + { + method: 'DELETE', + params: { ...queryParams }, + ...(options || {}), + }, + ); +} + +/** 此处后端没有提供注释 PUT /site-api/${param1}/media/${param0} */ +export async function siteapicontrollerUpdatemedia( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerUpdatemediaParams, + body: Record, + options?: { [key: string]: any }, +) { + const { id: param0, siteId: param1, ...queryParams } = params; + return request>(`/site-api/${param1}/media/${param0}`, { + method: 'PUT', + headers: { + 'Content-Type': 'text/plain', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 DELETE /site-api/${param1}/media/${param0} */ +export async function siteapicontrollerDeletemedia( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerDeletemediaParams, + options?: { [key: string]: any }, +) { + const { id: param0, siteId: param1, ...queryParams } = params; + return request>(`/site-api/${param1}/media/${param0}`, { + method: 'DELETE', + params: { ...queryParams }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 GET /site-api/${param1}/orders/${param0} */ +export async function siteapicontrollerGetorder( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerGetorderParams, + options?: { [key: string]: any }, +) { + const { id: param0, siteId: param1, ...queryParams } = params; + return request(`/site-api/${param1}/orders/${param0}`, { + method: 'GET', + params: { ...queryParams }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 PUT /site-api/${param1}/orders/${param0} */ +export async function siteapicontrollerUpdateorder( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerUpdateorderParams, + body: Record, + options?: { [key: string]: any }, +) { + const { id: param0, siteId: param1, ...queryParams } = params; + return request>(`/site-api/${param1}/orders/${param0}`, { + method: 'PUT', + headers: { + 'Content-Type': 'text/plain', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 DELETE /site-api/${param1}/orders/${param0} */ +export async function siteapicontrollerDeleteorder( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerDeleteorderParams, + options?: { [key: string]: any }, +) { + const { id: param0, siteId: param1, ...queryParams } = params; + return request>(`/site-api/${param1}/orders/${param0}`, { + method: 'DELETE', + params: { ...queryParams }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 GET /site-api/${param1}/orders/${param0}/notes */ +export async function siteapicontrollerGetordernotes( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerGetordernotesParams, + options?: { [key: string]: any }, +) { + const { id: param0, siteId: param1, ...queryParams } = params; + return request>( + `/site-api/${param1}/orders/${param0}/notes`, + { + method: 'GET', + params: { ...queryParams }, + ...(options || {}), + }, + ); +} + +/** 此处后端没有提供注释 POST /site-api/${param1}/orders/${param0}/notes */ +export async function siteapicontrollerCreateordernote( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerCreateordernoteParams, + body: Record, + options?: { [key: string]: any }, +) { + const { id: param0, siteId: param1, ...queryParams } = params; + return request>( + `/site-api/${param1}/orders/${param0}/notes`, + { + method: 'POST', + headers: { + 'Content-Type': 'text/plain', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }, + ); +} + +/** 此处后端没有提供注释 GET /site-api/${param1}/products/${param0} */ +export async function siteapicontrollerGetproduct( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerGetproductParams, + options?: { [key: string]: any }, +) { + const { id: param0, siteId: param1, ...queryParams } = params; + return request( + `/site-api/${param1}/products/${param0}`, + { + method: 'GET', + params: { ...queryParams }, + ...(options || {}), + }, + ); +} + +/** 此处后端没有提供注释 PUT /site-api/${param1}/products/${param0} */ +export async function siteapicontrollerUpdateproduct( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerUpdateproductParams, + body: API.UnifiedProductDTO, + options?: { [key: string]: any }, +) { + const { id: param0, siteId: param1, ...queryParams } = params; + return request( + `/site-api/${param1}/products/${param0}`, + { + method: 'PUT', + headers: { + 'Content-Type': 'application/json', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }, + ); +} + +/** 此处后端没有提供注释 DELETE /site-api/${param1}/products/${param0} */ +export async function siteapicontrollerDeleteproduct( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerDeleteproductParams, + options?: { [key: string]: any }, +) { + const { id: param0, siteId: param1, ...queryParams } = params; + return request>( + `/site-api/${param1}/products/${param0}`, + { + method: 'DELETE', + params: { ...queryParams }, + ...(options || {}), + }, + ); +} + +/** 此处后端没有提供注释 PUT /site-api/${param2}/products/${param1}/variations/${param0} */ +export async function siteapicontrollerUpdatevariation( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.siteapicontrollerUpdatevariationParams, + body: Record, + options?: { [key: string]: any }, +) { + const { + variationId: param0, + productId: param1, + siteId: param2, + ...queryParams + } = params; + return request>( + `/site-api/${param2}/products/${param1}/variations/${param0}`, + { + method: 'PUT', + headers: { + 'Content-Type': 'text/plain', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }, + ); +} diff --git a/src/servers/api/template.ts b/src/servers/api/template.ts index 316c389..dc7f360 100644 --- a/src/servers/api/template.ts +++ b/src/servers/api/template.ts @@ -64,6 +64,16 @@ export async function templatecontrollerDeletetemplate( }); } +/** 此处后端没有提供注释 POST /template/backfill-testdata */ +export async function templatecontrollerBackfilltestdata(options?: { + [key: string]: any; +}) { + return request>('/template/backfill-testdata', { + method: 'POST', + ...(options || {}), + }); +} + /** 此处后端没有提供注释 GET /template/list */ export async function templatecontrollerGettemplatelist(options?: { [key: string]: any; diff --git a/src/servers/api/typings.d.ts b/src/servers/api/typings.d.ts index dee1717..eb1edc7 100644 --- a/src/servers/api/typings.d.ts +++ b/src/servers/api/typings.d.ts @@ -14,20 +14,6 @@ declare namespace API { code?: string; }; - type BatchUpdateProductDTO = { - ids: number[]; - name?: string; - nameCn?: string; - description?: string; - shortDescription?: string; - sku?: string; - categoryId?: number; - attributes?: any[]; - price?: number; - promotionPrice?: number; - type?: 'single' | 'bundle'; - }; - type areacontrollerDeleteareaParams = { id: number; }; @@ -49,6 +35,73 @@ declare namespace API { id: number; }; + type BatchDeleteProductDTO = { + /** 产品ID列表 */ + ids: any[]; + }; + + type BatchSyncProductsDTO = { + /** 产品ID列表 */ + productIds?: number[]; + }; + + type BatchUpdateProductDTO = { + /** 产品ID列表 */ + ids: any[]; + /** 产品名称 */ + name?: string; + /** 产品中文名称 */ + nameCn?: string; + /** 产品描述 */ + description?: string; + /** 产品简短描述 */ + shortDescription?: string; + /** 产品 SKU */ + sku?: string; + /** 分类ID (DictItem ID) */ + categoryId?: number; + /** 站点 SKU 列表 */ + siteSkus?: any[]; + /** 价格 */ + price?: number; + /** 促销价格 */ + promotionPrice?: number; + /** 属性列表 */ + attributes?: any[]; + /** 商品类型 */ + type?: 'single' | 'bundle'; + }; + + type BatchUpdateProductsDTO = { + /** 产品ID列表 */ + ids?: number[]; + /** 常规价格 */ + regular_price?: number; + /** 销售价格 */ + sale_price?: number; + /** 分类列表 */ + categories?: string[]; + /** 标签列表 */ + tags?: string[]; + /** 状态 */ + status?: + | 'publish' + | 'draft' + | 'pending' + | 'private' + | 'trash' + | 'auto-draft' + | 'future' + | 'inherit'; + }; + + type BatchUpdateTagsDTO = { + /** 产品ID列表 */ + ids?: number[]; + /** 标签列表 */ + tags?: string[]; + }; + type BooleanRes = { /** 状态码 */ code?: number; @@ -99,6 +152,8 @@ declare namespace API { type CreateProductDTO = { /** 产品名称 */ name: string; + /** 产品中文名称 */ + nameCn?: string; /** 产品描述 */ description?: string; /** 产品简短描述 */ @@ -107,6 +162,8 @@ declare namespace API { sku?: string; /** 分类ID (DictItem ID) */ categoryId?: number; + /** 站点 SKU 列表 */ + siteSkus?: any[]; /** 属性列表 */ attributes?: any[]; /** 价格 */ @@ -114,11 +171,9 @@ declare namespace API { /** 促销价格 */ promotionPrice?: number; /** 商品类型 */ - type?: 'simple' | 'bundle'; + type?: 'single' | 'bundle'; /** 产品组成 */ components?: any[]; - /** 站点 SKU 列表 */ - siteSkus?: string[]; }; type CreatePurchaseOrderDTO = { @@ -132,6 +187,8 @@ declare namespace API { type CreateSiteDTO = { /** 区域 */ areas?: any; + /** 绑定仓库ID列表 */ + stockPointIds?: any; }; type CreateStockPointDTO = { @@ -141,6 +198,10 @@ declare namespace API { contactPhone?: string; /** 区域 */ areas?: any; + /** 上游仓库点ID */ + upStreamStockPointId?: number; + /** 上游名称 */ + upStreamName?: string; }; type CreateTemplateDTO = { @@ -308,6 +369,22 @@ declare namespace API { weight?: Cubid; }; + type mediacontrollerDeleteParams = { + force?: boolean; + siteId?: number; + id: number; + }; + + type mediacontrollerListParams = { + pageSize?: number; + page?: number; + siteId?: number; + }; + + type mediacontrollerUpdateParams = { + id: number; + }; + type Money = { currency?: string; value?: string; @@ -758,12 +835,10 @@ declare namespace API { price?: number; /** 促销价格 */ promotionPrice?: number; - /** 库存 */ - stock?: number; /** 库存组成 */ components?: ProductStockComponent[]; /** 站点 SKU 列表 */ - siteSkus?: { code: string }[]; + siteSkus?: ProductSiteSku[]; /** 来源 */ source?: number; /** 创建时间 */ @@ -776,6 +851,10 @@ declare namespace API { id: number; }; + type productcontrollerBindproductsiteskusParams = { + id: number; + }; + type productcontrollerCompatbrandsParams = { name?: string; pageSize?: Record; @@ -882,6 +961,14 @@ declare namespace API { categoryId?: number; /** 品牌ID */ brandId?: number; + /** 排序字段 */ + sortField?: string; + /** 排序方式 */ + sortOrder?: string; + }; + + type productcontrollerGetproductsiteskusParams = { + id: number; }; type productcontrollerProductbyskuParams = { @@ -892,10 +979,6 @@ declare namespace API { name?: string; }; - type productcontrollerSetproductcomponentsParams = { - id: number; - }; - type productcontrollerUpdateattributeParams = { dictName?: string; id: number; @@ -947,6 +1030,11 @@ declare namespace API { data?: Product; }; + type ProductSiteSku = { + /** 站点 SKU */ + code?: string; + }; + type ProductsRes = { /** 状态码 */ code?: number; @@ -1112,6 +1200,10 @@ declare namespace API { categoryId?: number; /** 品牌ID */ brandId?: number; + /** 排序字段 */ + sortField?: string; + /** 排序方式 */ + sortOrder?: string; }; type QueryPurchaseOrderDTO = { @@ -1200,6 +1292,8 @@ declare namespace API { | 'auto-draft' | 'future' | 'inherit'; + /** SKU列表 */ + skus?: any[]; }; type RateDTO = { @@ -1248,17 +1342,6 @@ declare namespace API { data?: Service[]; }; - type SetConstitutionDTO = { - isProduct?: boolean; - /** 构成成分 */ - constitution?: { sku?: string; quantity?: number }[]; - }; - - type SetProductComponentsDTO = { - /** 产品组成 */ - components: any[]; - }; - type ShipmentBookDTO = { sales?: OrderSale[]; details?: ShippingDetailsDTO; @@ -1324,6 +1407,299 @@ declare namespace API { reference_codes?: any; }; + type Site = {}; + + type siteapicontrollerBatchcustomersParams = { + siteId: number; + }; + + type siteapicontrollerBatchmediaParams = { + siteId: number; + }; + + type siteapicontrollerBatchordersParams = { + siteId: number; + }; + + type siteapicontrollerBatchproductsParams = { + siteId: number; + }; + + type siteapicontrollerCreatecustomerParams = { + siteId: number; + }; + + type siteapicontrollerCreateordernoteParams = { + id: string; + siteId: number; + }; + + type siteapicontrollerCreateorderParams = { + siteId: number; + }; + + type siteapicontrollerCreateproductParams = { + siteId: number; + }; + + type siteapicontrollerDeletecustomerParams = { + id: string; + siteId: number; + }; + + type siteapicontrollerDeletemediaParams = { + id: string; + siteId: number; + }; + + type siteapicontrollerDeleteorderParams = { + id: string; + siteId: number; + }; + + type siteapicontrollerDeleteproductParams = { + id: string; + siteId: number; + }; + + type siteapicontrollerExportcustomersParams = { + /** 页码 */ + page?: number; + /** 每页数量 */ + per_page?: number; + /** 搜索关键词 */ + search?: string; + /** 状态 */ + status?: string; + /** 排序字段 */ + orderby?: string; + /** 排序方式 */ + order?: string; + siteId: number; + }; + + type siteapicontrollerExportmediaParams = { + /** 页码 */ + page?: number; + /** 每页数量 */ + per_page?: number; + /** 搜索关键词 */ + search?: string; + /** 状态 */ + status?: string; + /** 排序字段 */ + orderby?: string; + /** 排序方式 */ + order?: string; + siteId: number; + }; + + type siteapicontrollerExportordersParams = { + /** 页码 */ + page?: number; + /** 每页数量 */ + per_page?: number; + /** 搜索关键词 */ + search?: string; + /** 状态 */ + status?: string; + /** 排序字段 */ + orderby?: string; + /** 排序方式 */ + order?: string; + siteId: number; + }; + + type siteapicontrollerExportproductsParams = { + /** 页码 */ + page?: number; + /** 每页数量 */ + per_page?: number; + /** 搜索关键词 */ + search?: string; + /** 状态 */ + status?: string; + /** 排序字段 */ + orderby?: string; + /** 排序方式 */ + order?: string; + siteId: number; + }; + + type siteapicontrollerExportproductsspecialParams = { + /** 页码 */ + page?: number; + /** 每页数量 */ + per_page?: number; + /** 搜索关键词 */ + search?: string; + /** 状态 */ + status?: string; + /** 排序字段 */ + orderby?: string; + /** 排序方式 */ + order?: string; + siteId: number; + }; + + type siteapicontrollerExportsubscriptionsParams = { + /** 页码 */ + page?: number; + /** 每页数量 */ + per_page?: number; + /** 搜索关键词 */ + search?: string; + /** 状态 */ + status?: string; + /** 排序字段 */ + orderby?: string; + /** 排序方式 */ + order?: string; + siteId: number; + }; + + type siteapicontrollerGetcustomerParams = { + id: string; + siteId: number; + }; + + type siteapicontrollerGetcustomersParams = { + /** 页码 */ + page?: number; + /** 每页数量 */ + per_page?: number; + /** 搜索关键词 */ + search?: string; + /** 状态 */ + status?: string; + /** 排序字段 */ + orderby?: string; + /** 排序方式 */ + order?: string; + siteId: number; + }; + + type siteapicontrollerGetmediaParams = { + /** 页码 */ + page?: number; + /** 每页数量 */ + per_page?: number; + /** 搜索关键词 */ + search?: string; + /** 状态 */ + status?: string; + /** 排序字段 */ + orderby?: string; + /** 排序方式 */ + order?: string; + siteId: number; + }; + + type siteapicontrollerGetordernotesParams = { + id: string; + siteId: number; + }; + + type siteapicontrollerGetorderParams = { + id: string; + siteId: number; + }; + + type siteapicontrollerGetordersParams = { + /** 页码 */ + page?: number; + /** 每页数量 */ + per_page?: number; + /** 搜索关键词 */ + search?: string; + /** 状态 */ + status?: string; + /** 排序字段 */ + orderby?: string; + /** 排序方式 */ + order?: string; + siteId: number; + }; + + type siteapicontrollerGetproductParams = { + id: string; + siteId: number; + }; + + type siteapicontrollerGetproductsParams = { + /** 页码 */ + page?: number; + /** 每页数量 */ + per_page?: number; + /** 搜索关键词 */ + search?: string; + /** 状态 */ + status?: string; + /** 排序字段 */ + orderby?: string; + /** 排序方式 */ + order?: string; + siteId: number; + }; + + type siteapicontrollerGetsubscriptionsParams = { + /** 页码 */ + page?: number; + /** 每页数量 */ + per_page?: number; + /** 搜索关键词 */ + search?: string; + /** 状态 */ + status?: string; + /** 排序字段 */ + orderby?: string; + /** 排序方式 */ + order?: string; + siteId: number; + }; + + type siteapicontrollerImportcustomersParams = { + siteId: number; + }; + + type siteapicontrollerImportordersParams = { + siteId: number; + }; + + type siteapicontrollerImportproductsParams = { + siteId: number; + }; + + type siteapicontrollerImportproductsspecialParams = { + siteId: number; + }; + + type siteapicontrollerUpdatecustomerParams = { + id: string; + siteId: number; + }; + + type siteapicontrollerUpdatemediaParams = { + id: string; + siteId: number; + }; + + type siteapicontrollerUpdateorderParams = { + id: string; + siteId: number; + }; + + type siteapicontrollerUpdateproductParams = { + id: string; + siteId: number; + }; + + type siteapicontrollerUpdatevariationParams = { + variationId: string; + productId: string; + siteId: number; + }; + type SiteConfig = { /** 站点 ID */ id?: string; @@ -1335,6 +1711,8 @@ declare namespace API { consumerSecret?: string; /** 站点名 */ name?: string; + /** 描述 */ + description?: string; /** 平台类型 */ type?: 'woocommerce' | 'shopyy'; /** SKU 前缀 */ @@ -1647,6 +2025,7 @@ declare namespace API { name?: string; value?: string; description?: string; + /** 测试数据JSON */ testData?: string; /** 是否可删除 */ deletable: boolean; @@ -1677,6 +2056,230 @@ declare namespace API { minute?: string; }; + type UnifiedCustomerDTO = { + /** 客户ID */ + id?: Record; + /** 邮箱 */ + email?: string; + /** 名 */ + first_name?: string; + /** 姓 */ + last_name?: string; + /** 名字 */ + fullname?: string; + /** 用户名 */ + username?: string; + /** 电话 */ + phone?: string; + /** 账单地址 */ + billing?: any; + /** 收货地址 */ + shipping?: any; + /** 原始数据 */ + raw?: any; + }; + + type UnifiedCustomerPaginationDTO = { + /** 列表数据 */ + items?: UnifiedCustomerDTO[]; + /** 总数 */ + total?: number; + /** 当前页 */ + page?: number; + /** 每页数量 */ + per_page?: number; + /** 总页数 */ + totalPages?: number; + }; + + type UnifiedImageDTO = { + /** 图片ID */ + id?: Record; + /** 图片URL */ + src?: string; + /** 图片名称 */ + name?: string; + /** 替代文本 */ + alt?: string; + }; + + type UnifiedMediaDTO = { + /** 媒体ID */ + id?: number; + /** 标题 */ + title?: string; + /** 媒体类型 */ + media_type?: string; + /** MIME类型 */ + mime_type?: string; + /** 源URL */ + source_url?: string; + /** 创建时间 */ + date_created?: string; + }; + + type UnifiedMediaPaginationDTO = { + /** 列表数据 */ + items?: UnifiedMediaDTO[]; + /** 总数 */ + total?: number; + /** 当前页 */ + page?: number; + /** 每页数量 */ + per_page?: number; + /** 总页数 */ + totalPages?: number; + }; + + type UnifiedOrderDTO = { + /** 订单ID */ + id?: Record; + /** 订单号 */ + number?: string; + /** 订单状态 */ + status?: string; + /** 货币 */ + currency?: string; + /** 总金额 */ + total?: string; + /** 客户ID */ + customer_id?: number; + /** 客户姓名 */ + customer_name?: string; + /** 客户邮箱 */ + email?: string; + /** 订单项 */ + line_items?: any; + /** 销售项(兼容前端) */ + sales?: any; + /** 账单地址 */ + billing?: any; + /** 收货地址 */ + shipping?: any; + /** 账单地址全称 */ + billing_full_address?: string; + /** 收货地址全称 */ + shipping_full_address?: string; + /** 支付方式 */ + payment_method?: string; + /** 创建时间 */ + date_created?: string; + /** 原始数据 */ + raw?: any; + }; + + type UnifiedOrderPaginationDTO = { + /** 列表数据 */ + items?: UnifiedOrderDTO[]; + /** 总数 */ + total?: number; + /** 当前页 */ + page?: number; + /** 每页数量 */ + per_page?: number; + /** 总页数 */ + totalPages?: number; + }; + + type UnifiedProductDTO = { + /** 产品ID */ + id?: Record; + /** 产品名称 */ + name?: string; + /** 产品类型 */ + type?: string; + /** 产品状态 */ + status?: string; + /** 产品SKU */ + sku?: string; + /** 常规价格 */ + regular_price?: string; + /** 销售价格 */ + sale_price?: string; + /** 当前价格 */ + price?: string; + /** 库存状态 */ + stock_status?: string; + /** 库存数量 */ + stock_quantity?: number; + /** 产品图片 */ + images?: UnifiedImageDTO[]; + /** 产品标签 */ + tags?: any; + /** 产品属性 */ + attributes?: any; + /** 产品变体 */ + variations?: any; + /** 创建时间 */ + date_created?: string; + /** 更新时间 */ + date_modified?: string; + /** 原始数据(保留备用) */ + raw?: any; + }; + + type UnifiedProductPaginationDTO = { + /** 列表数据 */ + items?: UnifiedProductDTO[]; + /** 总数 */ + total?: number; + /** 当前页 */ + page?: number; + /** 每页数量 */ + per_page?: number; + /** 总页数 */ + totalPages?: number; + }; + + type UnifiedSearchParamsDTO = { + /** 页码 */ + page?: number; + /** 每页数量 */ + per_page?: number; + /** 搜索关键词 */ + search?: string; + /** 状态 */ + status?: string; + /** 排序字段 */ + orderby?: string; + /** 排序方式 */ + order?: string; + }; + + type UnifiedSubscriptionDTO = { + /** 订阅ID */ + id?: Record; + /** 订阅状态 */ + status?: string; + /** 客户ID */ + customer_id?: number; + /** 计费周期 */ + billing_period?: string; + /** 计费间隔 */ + billing_interval?: number; + /** 开始时间 */ + start_date?: string; + /** 下次支付时间 */ + next_payment_date?: string; + /** 订单项 */ + line_items?: any; + /** 原始数据 */ + raw?: any; + }; + + type UnifiedSubscriptionPaginationDTO = { + /** 列表数据 */ + items?: UnifiedSubscriptionDTO[]; + /** 总数 */ + total?: number; + /** 当前页 */ + page?: number; + /** 每页数量 */ + per_page?: number; + /** 总页数 */ + totalPages?: number; + }; + type UpdateAreaDTO = { /** 编码 */ code?: string; @@ -1699,6 +2302,8 @@ declare namespace API { sku?: string; /** 分类ID (DictItem ID) */ categoryId?: number; + /** 站点 SKU 列表 */ + siteSkus?: any[]; /** 价格 */ price?: number; /** 促销价格 */ @@ -1706,9 +2311,9 @@ declare namespace API { /** 属性列表 */ attributes?: any[]; /** 商品类型 */ - type?: 'simple' | 'bundle'; - /** 站点 SKU 列表 */ - siteSkus?: string[]; + type?: 'single' | 'bundle'; + /** 产品组成 */ + components?: any[]; }; type UpdatePurchaseOrderDTO = { @@ -1722,6 +2327,8 @@ declare namespace API { type UpdateSiteDTO = { /** 区域 */ areas?: any; + /** 绑定仓库ID列表 */ + stockPointIds?: any; }; type UpdateStockDTO = { @@ -1740,6 +2347,10 @@ declare namespace API { contactPhone?: string; /** 区域 */ areas?: any; + /** 上游仓库点ID */ + upStreamStockPointId?: number; + /** 上游名称 */ + upStreamName?: string; }; type UpdateTemplateDTO = { @@ -1775,6 +2386,12 @@ declare namespace API { sale_price?: number; /** 是否促销中 */ on_sale?: boolean; + /** 分类列表 */ + categories?: string[]; + /** 标签列表 */ + tags?: string[]; + /** 站点ID */ + siteId?: number; }; type usercontrollerUpdateuserParams = { @@ -1808,14 +2425,24 @@ declare namespace API { createdAt: string; /** 更新时间 */ updatedAt: string; - /** 变体构成成分 */ - constitution?: { sku?: string; quantity?: number }[]; }; type webhookcontrollerHandlewoowebhookParams = { siteId?: string; }; + type wpproductcontrollerBatchsynctositeParams = { + siteId: number; + }; + + type wpproductcontrollerCreateproductParams = { + siteId: number; + }; + + type wpproductcontrollerDeleteParams = { + id: number; + }; + type wpproductcontrollerGetwpproductsParams = { /** 页码 */ current?: number; @@ -1835,20 +2462,26 @@ declare namespace API { | 'auto-draft' | 'future' | 'inherit'; + /** SKU列表 */ + skus?: any[]; + }; + + type wpproductcontrollerImportproductsParams = { + siteId: number; }; type wpproductcontrollerSearchproductsParams = { name?: string; }; - type wpproductcontrollerSetconstitutionParams = { - id: number; - }; - type wpproductcontrollerSyncproductsParams = { siteId: number; }; + type wpproductcontrollerSynctoproductParams = { + id: number; + }; + type wpproductcontrollerUpdateproductParams = { productId: string; siteId: number; @@ -1869,6 +2502,8 @@ declare namespace API { id: number; /** wp网站ID */ siteId: number; + /** 站点信息 */ + site?: Site; /** wp产品ID */ externalProductId: string; /** 商店sku */ @@ -1957,8 +2592,6 @@ declare namespace API { createdAt: string; /** 更新时间 */ updatedAt: string; - /** 产品构成成分 */ - constitution?: { sku?: string; quantity?: number }[]; /** 变体列表 */ variations?: VariationDTO[]; }; diff --git a/src/servers/api/wpProduct.ts b/src/servers/api/wpProduct.ts index d500898..637bc2d 100644 --- a/src/servers/api/wpProduct.ts +++ b/src/servers/api/wpProduct.ts @@ -2,16 +2,30 @@ /* eslint-disable */ import { request } from 'umi'; -/** 此处后端没有提供注释 PUT /wp_product/${param0}/constitution */ -export async function wpproductcontrollerSetconstitution( +/** 此处后端没有提供注释 DELETE /wp_product/${param0} */ +export async function wpproductcontrollerDelete( // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.wpproductcontrollerSetconstitutionParams, - body: API.SetConstitutionDTO, + params: API.wpproductcontrollerDeleteParams, options?: { [key: string]: any }, ) { const { id: param0, ...queryParams } = params; - return request(`/wp_product/${param0}/constitution`, { - method: 'PUT', + return request(`/wp_product/${param0}`, { + method: 'DELETE', + params: { ...queryParams }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 POST /wp_product/batch-sync-to-site/${param0} */ +export async function wpproductcontrollerBatchsynctosite( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.wpproductcontrollerBatchsynctositeParams, + body: API.BatchSyncProductsDTO, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request(`/wp_product/batch-sync-to-site/${param0}`, { + method: 'POST', headers: { 'Content-Type': 'application/json', }, @@ -21,10 +35,83 @@ export async function wpproductcontrollerSetconstitution( }); } +/** 此处后端没有提供注释 POST /wp_product/batch-update */ +export async function wpproductcontrollerBatchupdateproducts( + body: API.BatchUpdateProductsDTO, + options?: { [key: string]: any }, +) { + return request('/wp_product/batch-update', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 POST /wp_product/batch-update-tags */ +export async function wpproductcontrollerBatchupdatetags( + body: API.BatchUpdateTagsDTO, + options?: { [key: string]: any }, +) { + return request('/wp_product/batch-update-tags', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 POST /wp_product/import/${param0} */ +export async function wpproductcontrollerImportproducts( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.wpproductcontrollerImportproductsParams, + body: {}, + files?: File[], + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + const formData = new FormData(); + + if (files) { + files.forEach((f) => formData.append('files', f || '')); + } + + Object.keys(body).forEach((ele) => { + const item = (body as any)[ele]; + + if (item !== undefined && item !== null) { + if (typeof item === 'object' && !(item instanceof File)) { + if (item instanceof Array) { + item.forEach((f) => formData.append(ele, f || '')); + } else { + formData.append( + ele, + new Blob([JSON.stringify(item)], { type: 'application/json' }), + ); + } + } else { + formData.append(ele, item); + } + } + }); + + return request(`/wp_product/import/${param0}`, { + method: 'POST', + params: { ...queryParams }, + data: formData, + requestType: 'form', + ...(options || {}), + }); +} + /** 此处后端没有提供注释 GET /wp_product/list */ export async function wpproductcontrollerGetwpproducts( // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.wpproductcontrollerGetwpproductsParams & { skus?: string[] }, + params: API.wpproductcontrollerGetwpproductsParams, options?: { [key: string]: any }, ) { return request('/wp_product/list', { @@ -51,6 +138,40 @@ export async function wpproductcontrollerSearchproducts( }); } +/** 此处后端没有提供注释 POST /wp_product/setconstitution */ +export async function wpproductcontrollerSetconstitution( + body: Record, + options?: { [key: string]: any }, +) { + return request('/wp_product/setconstitution', { + method: 'POST', + headers: { + 'Content-Type': 'text/plain', + }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 POST /wp_product/siteId/${param0}/products */ +export async function wpproductcontrollerCreateproduct( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.wpproductcontrollerCreateproductParams, + body: Record, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request(`/wp_product/siteId/${param0}/products`, { + method: 'POST', + headers: { + 'Content-Type': 'text/plain', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }); +} + /** 此处后端没有提供注释 PUT /wp_product/siteId/${param1}/products/${param0} */ export async function wpproductcontrollerUpdateproduct( // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) @@ -100,6 +221,20 @@ export async function wpproductcontrollerUpdatevariation( ); } +/** 此处后端没有提供注释 POST /wp_product/sync-to-product/${param0} */ +export async function wpproductcontrollerSynctoproduct( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.wpproductcontrollerSynctoproductParams, + options?: { [key: string]: any }, +) { + const { id: param0, ...queryParams } = params; + return request(`/wp_product/sync-to-product/${param0}`, { + method: 'POST', + params: { ...queryParams }, + ...(options || {}), + }); +} + /** 此处后端没有提供注释 POST /wp_product/sync/${param0} */ export async function wpproductcontrollerSyncproducts( // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) @@ -132,92 +267,3 @@ export async function wpproductcontrollerUpdatewpproductstate( ...(options || {}), }); } - -export async function wpproductcontrollerBatchSyncToSite( - params: { siteId: number }, - body: { productIds: number[] }, - options?: { [key: string]: any }, -) { - const { siteId, ...queryParams } = params; - return request(`/wp_product/batch-sync-to-site/${siteId}`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - params: { ...queryParams }, - data: body, - ...(options || {}), - }); -} - -export async function wpproductcontrollerSyncToProduct( - params: { id: number }, - options?: { [key: string]: any }, -) { - const { id, ...queryParams } = params; - return request(`/wp_product/sync-to-product/${id}`, { - method: 'POST', - params: { ...queryParams }, - ...(options || {}), - }); -} - -export async function wpproductcontrollerBatchUpdateTags( - body: { ids: number[]; tags: string[] }, - options?: { [key: string]: any }, -) { - return request('/wp_product/batch-update-tags', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - data: body, - ...(options || {}), - }); -} - -export async function wpproductcontrollerImportProducts( - params: { siteId: number }, - body: FormData, - options?: { [key: string]: any }, -) { - const { siteId, ...queryParams } = params; - return request(`/wp_product/import/${siteId}`, { - method: 'POST', - params: { ...queryParams }, - data: body, - requestType: 'form', - ...(options || {}), - }); -} - -export async function wpproductcontrollerCreateproduct( - params: { siteId: number }, - body: any, - options?: { [key: string]: any }, -) { - const { siteId, ...queryParams } = params; - return request(`/wp_product/siteId/${siteId}/products`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - params: { ...queryParams }, - data: body, - ...(options || {}), - }); -} - -export async function wpproductcontrollerBatchUpdateProducts( - body: any, - options?: { [key: string]: any }, -) { - return request('/wp_product/batch-update', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - data: body, - ...(options || {}), - }); -}