diff --git a/src/pages/Product/Attribute/index.tsx b/src/pages/Product/Attribute/index.tsx new file mode 100644 index 0000000..fc1dae5 --- /dev/null +++ b/src/pages/Product/Attribute/index.tsx @@ -0,0 +1,243 @@ +import { UploadOutlined } from '@ant-design/icons'; +import { PageContainer } from '@ant-design/pro-components'; +import { request } from '@umijs/max'; +import { Button, Form, Input, Layout, Modal, Space, Table, Upload, message } from 'antd'; +import React, { useEffect, useState } from 'react'; + +const { Sider, Content } = Layout; + +// 中文注释:限定允许管理的字典名称集合 +const allowedDictNames = new Set(['brand', 'strength', 'flavor', 'size', 'humidity']); + +const AttributePage: React.FC = () => { + // 中文注释:左侧字典列表状态 + const [dicts, setDicts] = useState([]); + const [loadingDicts, setLoadingDicts] = useState(false); + const [searchText, setSearchText] = useState(''); + const [selectedDict, setSelectedDict] = useState(null); + + // 中文注释:右侧字典项状态 + const [dictItems, setDictItems] = useState([]); + const [loadingDictItems, setLoadingDictItems] = useState(false); + + // 中文注释:字典项新增/编辑模态框控制 + const [isDictItemModalVisible, setIsDictItemModalVisible] = useState(false); + const [editingDictItem, setEditingDictItem] = useState(null); + const [dictItemForm] = Form.useForm(); + + // 中文注释:获取字典列表,仅保留允许的名称 + const fetchDicts = async (title?: string) => { + setLoadingDicts(true); + try { + const res = await request('/dict/list', { params: { title } }); + // 中文注释:条件判断,过滤只保留 allowedDictNames 中的字典 + const filtered = (res || []).filter((d: any) => allowedDictNames.has(d?.name)); + setDicts(filtered); + } catch (error) { + message.error('获取字典列表失败'); + } + setLoadingDicts(false); + }; + + // 中文注释:获取字典项列表 + const fetchDictItems = async (dictId?: number) => { + setLoadingDictItems(true); + try { + const res = await request('/dict/items', { params: { dictId } }); + setDictItems(res || []); + } catch (error) { + message.error('获取字典项列表失败'); + } + setLoadingDictItems(false); + }; + + // 中文注释:组件挂载时初始化数据 + useEffect(() => { + fetchDicts(); + fetchDictItems(); + }, []); + + // 中文注释:当选择的字典发生变化时刷新右侧字典项 + useEffect(() => { + fetchDictItems(selectedDict?.id); + }, [selectedDict]); + + // 中文注释:搜索触发过滤 + const handleSearch = (value: string) => { + fetchDicts(value); + }; + + // 中文注释:打开添加字典项模态框 + const handleAddDictItem = () => { + setEditingDictItem(null); + dictItemForm.resetFields(); + setIsDictItemModalVisible(true); + }; + + // 中文注释:打开编辑字典项模态框 + const handleEditDictItem = (item: any) => { + setEditingDictItem(item); + dictItemForm.setFieldsValue(item); + setIsDictItemModalVisible(true); + }; + + // 中文注释:字典项表单提交(新增或编辑) + const handleDictItemFormSubmit = async (values: any) => { + try { + if (editingDictItem) { + // 中文注释:条件判断,存在编辑项则执行更新 + await request(`/dict/item/${editingDictItem.id}`, { + method: 'PUT', + data: values, + }); + message.success('更新成功'); + } else { + // 中文注释:否则执行新增,绑定到当前选择的字典 + await request('/dict/item', { + method: 'POST', + data: { ...values, dictId: selectedDict.id }, + }); + message.success('添加成功'); + } + setIsDictItemModalVisible(false); + fetchDictItems(selectedDict.id); + } catch (error) { + message.error(editingDictItem ? '更新失败' : '添加失败'); + } + }; + + // 中文注释:删除字典项 + const handleDeleteDictItem = async (itemId: number) => { + try { + await request(`/dict/item/${itemId}`, { method: 'DELETE' }); + message.success('删除成功'); + fetchDictItems(selectedDict.id); + } catch (error) { + message.error('删除失败'); + } + }; + + // 中文注释:左侧字典列表列定义(紧凑样式) + const dictColumns = [ + { title: '名称', dataIndex: 'name', key: 'name' }, + { title: '标题', dataIndex: 'title', key: 'title' }, + ]; + + // 中文注释:右侧字典项列表列定义(紧凑样式) + const dictItemColumns = [ + { title: '名称', dataIndex: 'name', key: 'name' }, + { title: '标题', dataIndex: 'title', key: 'title' }, + { title: '中文标题', dataIndex: 'titleCN', key: 'titleCN' }, + { + title: '操作', + key: 'action', + render: (_: any, record: any) => ( + + + + + ), + }, + ]; + + return ( + + + + + setSearchText(e.target.value)} + enterButton + allowClear + size="small" + /> + ({ + onClick: () => { + // 中文注释:条件判断,重复点击同一行则取消选择 + if (selectedDict?.id === record.id) { + setSelectedDict(null); + } else { + setSelectedDict(record); + } + }, + })} + rowClassName={(record) => (selectedDict?.id === record.id ? 'ant-table-row-selected' : '')} + pagination={false} + /> + + + + +
+ + { + // 中文注释:条件判断,上传状态处理 + if (info.file.status === 'done') { + message.success(`${info.file.name} 文件上传成功`); + fetchDictItems(selectedDict.id); + } else if (info.file.status === 'error') { + message.error(`${info.file.name} 文件上传失败`); + } + }} + > + + +
+
+ + + + + dictItemForm.submit()} + onCancel={() => setIsDictItemModalVisible(false)} + destroyOnClose + > +
+ + + + + + + + + + + + + +
+ + ); +}; + +export default AttributePage; + diff --git a/src/pages/Product/Brand/index.tsx b/src/pages/Product/Brand/index.tsx deleted file mode 100644 index 387643d..0000000 --- a/src/pages/Product/Brand/index.tsx +++ /dev/null @@ -1,208 +0,0 @@ -import { - productcontrollerCreatebrand, - productcontrollerDeletebrand, - productcontrollerGetbrands, - productcontrollerUpdatebrand, -} from '@/servers/api/product'; -import { EditOutlined, PlusOutlined } from '@ant-design/icons'; -import { - ActionType, - DrawerForm, - PageContainer, - ProColumns, - ProForm, - ProFormText, - ProTable, -} from '@ant-design/pro-components'; -import { App, Button, Popconfirm } from 'antd'; -import { useRef } from 'react'; - -const List: React.FC = () => { - const actionRef = useRef(); - const { message } = App.useApp(); - const columns: ProColumns[] = [ - { - title: '名称', - dataIndex: 'name', - tip: '名称是唯一的 key', - formItemProps: { - rules: [ - { - required: true, - message: '名称为必填项', - }, - ], - }, - }, - { - title: '标识', - dataIndex: 'unique_key', - hideInSearch: true, - }, - { - title: '更新时间', - dataIndex: 'updatedAt', - valueType: 'dateTime', - hideInSearch: true, - }, - { - title: '创建时间', - dataIndex: 'createdAt', - valueType: 'dateTime', - hideInSearch: true, - }, - { - title: '操作', - dataIndex: 'option', - valueType: 'option', - render: (_, record) => ( - <> - {/* - */} - { - try { - const { success, message: errMsg } = - await productcontrollerDeletebrand({ id: record.id }); - if (!success) { - throw new Error(errMsg); - } - actionRef.current?.reload(); - } catch (error: any) { - message.error(error.message); - } - }} - > - - - - ), - }, - ]; - - return ( - - - headerTitle="查询表格" - actionRef={actionRef} - rowKey="id" - toolBarRender={() => []} - request={async (params) => { - const { data, success } = await productcontrollerGetbrands(params); - return { - total: data?.total || 0, - data: data?.items || [], - success, - }; - }} - columns={columns} - /> - - ); -}; - -const CreateForm: React.FC<{ - tableRef: React.MutableRefObject; -}> = ({ tableRef }) => { - const { message } = App.useApp(); - return ( - - title="新建" - trigger={ - - } - autoFocusFirstInput - drawerProps={{ - destroyOnHidden: true, - }} - onFinish={async (values) => { - try { - const { success, message: errMsg } = - await productcontrollerCreatebrand(values); - if (!success) { - throw new Error(errMsg); - } - tableRef.current?.reload(); - message.success('提交成功'); - return true; - } catch (error: any) { - message.error(error.message); - } - }} - > - - - - ); -}; - -const UpdateForm: React.FC<{ - tableRef: React.MutableRefObject; - values: API.Brand; -}> = ({ tableRef, values: initialValues }) => { - const { message } = App.useApp(); - return ( - - title="编辑" - initialValues={initialValues} - trigger={ - - } - autoFocusFirstInput - drawerProps={{ - destroyOnHidden: true, - }} - onFinish={async (values) => { - try { - const { success, message: errMsg } = - await productcontrollerUpdatebrand( - { id: initialValues.id }, - values, - ); - if (!success) { - throw new Error(errMsg); - } - message.success('提交成功'); - tableRef.current?.reload(); - return true; - } catch (error: any) { - message.error(error.message); - } - }} - > - - - - - ); -}; - -export default List; diff --git a/src/pages/Product/Flavors/index.tsx b/src/pages/Product/Flavors/index.tsx deleted file mode 100644 index 358399e..0000000 --- a/src/pages/Product/Flavors/index.tsx +++ /dev/null @@ -1,207 +0,0 @@ -import { - productcontrollerCreateflavors, - productcontrollerDeleteflavors, - productcontrollerGetflavors, - productcontrollerUpdateflavors, -} from '@/servers/api/product'; -import { EditOutlined, PlusOutlined } from '@ant-design/icons'; -import { - ActionType, - DrawerForm, - PageContainer, - ProColumns, - ProForm, - ProFormText, - ProTable, -} from '@ant-design/pro-components'; -import { App, Button, Popconfirm } from 'antd'; -import { useRef } from 'react'; - -const List: React.FC = () => { - const actionRef = useRef(); - const { message } = App.useApp(); - const columns: ProColumns[] = [ - { - title: '名称', - dataIndex: 'name', - tip: '名称是唯一的 key', - formItemProps: { - rules: [ - { - required: true, - message: '名称为必填项', - }, - ], - }, - }, - { - title: '显示名称', - dataIndex: 'title', - }, - { - title: '更新时间', - dataIndex: 'updatedAt', - valueType: 'dateTime', - hideInSearch: true, - }, - { - title: '创建时间', - dataIndex: 'createdAt', - valueType: 'dateTime', - hideInSearch: true, - }, - { - title: '操作', - dataIndex: 'option', - valueType: 'option', - render: (_, record) => ( - <> - {/* - */} - { - try { - const { success, message: errMsg } = - await productcontrollerDeleteflavors({ id: record.id }); - if (!success) { - throw new Error(errMsg); - } - actionRef.current?.reload(); - } catch (error: any) { - message.error(error.message); - } - }} - > - - - - ), - }, - ]; - - return ( - - - headerTitle="查询表格" - actionRef={actionRef} - rowKey="id" - toolBarRender={() => []} - request={async (params) => { - const { data, success } = await productcontrollerGetflavors(params); - return { - total: data?.total || 0, - data: data?.items || [], - success, - }; - }} - columns={columns} - /> - - ); -}; - -const CreateForm: React.FC<{ - tableRef: React.MutableRefObject; -}> = ({ tableRef }) => { - const { message } = App.useApp(); - return ( - - title="新建" - trigger={ - - } - autoFocusFirstInput - drawerProps={{ - destroyOnHidden: true, - }} - onFinish={async (values) => { - try { - const { success, message: errMsg } = - await productcontrollerCreateflavors(values); - if (!success) { - throw new Error(errMsg); - } - tableRef.current?.reload(); - message.success('提交成功'); - return true; - } catch (error: any) { - message.error(error.message); - } - }} - > - - - - ); -}; - -const UpdateForm: React.FC<{ - tableRef: React.MutableRefObject; - values: API.Category; -}> = ({ tableRef, values: initialValues }) => { - const { message } = App.useApp(); - return ( - - title="编辑" - initialValues={initialValues} - trigger={ - - } - autoFocusFirstInput - drawerProps={{ - destroyOnHidden: true, - }} - onFinish={async (values) => { - try { - const { success, message: errMsg } = - await productcontrollerUpdateflavors( - { id: initialValues.id }, - values, - ); - if (!success) { - throw new Error(errMsg); - } - message.success('提交成功'); - tableRef.current?.reload(); - return true; - } catch (error: any) { - message.error(error.message); - } - }} - > - - - - - ); -}; - -export default List; diff --git a/src/pages/Product/List/index.tsx b/src/pages/Product/List/index.tsx index d94269b..889f1ba 100644 --- a/src/pages/Product/List/index.tsx +++ b/src/pages/Product/List/index.tsx @@ -1,12 +1,16 @@ import { productcontrollerCreateproduct, productcontrollerDeleteproduct, - productcontrollerGetbrandall, - productcontrollerGetflavorsall, + productcontrollerCompatbrandall, + productcontrollerCompatflavorsall, productcontrollerGetproductlist, - productcontrollerGetstrengthall, + productcontrollerCompatstrengthall, productcontrollerUpdateproductnamecn, productcontrollerUpdateproduct, + productcontrollerGetproductcomponents, + productcontrollerSetproductcomponents, + productcontrollerAutobindcomponents, + productcontrollerGetattributeall, } from '@/servers/api/product'; import { templatecontrollerRendertemplate } from '@/servers/api/template'; import { PlusOutlined } from '@ant-design/icons'; @@ -17,6 +21,7 @@ import { ProColumns, ProForm, ProFormInstance, + ProFormList, ProFormSelect, ProFormText, ProFormTextArea, @@ -102,21 +107,21 @@ const List: React.FC = () => { hideInSearch: true, }, { - title: '产品描述', + title: '描述', dataIndex: 'description', hideInSearch: true, }, { - title: '产品品牌', - dataIndex: 'brandName', + title: '品牌', + dataIndex: 'brand.name', }, { title: '强度', - dataIndex: 'strengthName', + dataIndex: 'strength.name', }, { title: '口味', - dataIndex: 'flavorsName', + dataIndex: 'flavors.name', }, { title: '湿度', @@ -306,8 +311,22 @@ const CreateForm: React.FC<{ destroyOnHidden: true, }} onFinish={async (values) => { + // 中文注释:将选择的字典项ID与干湿属性组装为后端需要的 attributes + const payload: any = { + name: values.name, + description: values.description, + sku: values.sku, + price: values.price, + promotionPrice: values.promotionPrice, + attributes: [ + values.brandId ? { id: values.brandId } : null, + values.strengthId ? { id: values.strengthId } : null, + values.flavorsId ? { id: values.flavorsId } : null, + values.humidity ? { dictName: 'humidity', name: values.humidity } : null, + ].filter(Boolean), + }; const { success, message: errMsg } = - await productcontrollerCreateproduct(values); + await productcontrollerCreateproduct(payload); if (success) { message.success('提交成功'); tableRef.current?.reloadAndRest?.(); @@ -323,7 +342,7 @@ const CreateForm: React.FC<{ label="产品品牌" placeholder="请选择产品品牌" request={async () => { - const { data = [] } = await productcontrollerGetbrandall(); + const { data = [] } = await productcontrollerCompatbrandall(); setBrandOptions(data); return data.map((item: DictItem) => ({ label: item.name, @@ -338,7 +357,7 @@ const CreateForm: React.FC<{ label="强度" placeholder="请选择强度" request={async () => { - const { data = [] } = await productcontrollerGetstrengthall(); + const { data = [] } = await productcontrollerCompatstrengthall(); setStrengthOptions(data); return data.map((item: DictItem) => ({ label: item.name, @@ -353,7 +372,7 @@ const CreateForm: React.FC<{ label="口味" placeholder="请选择口味" request={async () => { - const { data = [] } = await productcontrollerGetflavorsall(); + const { data = [] } = await productcontrollerCompatflavorsall(); setFlavorOptions(data); return data.map((item: DictItem) => ({ label: item.name, @@ -367,9 +386,9 @@ const CreateForm: React.FC<{ width="lg" label="干湿" placeholder="请选择干湿" - valueEnum={{ - dry: 'dry', - moisture: 'moisture', + request={async () => { + const { data = [] } = await productcontrollerGetattributeall({ dictName: 'humidity' } as any); + return (data || []).map((item: any) => ({ label: item.name, value: item.name })); }} rules={[{ required: true, message: '请选择干湿' }]} /> @@ -432,11 +451,13 @@ const EditForm: React.FC<{ const [brandOptions, setBrandOptions] = useState([]); const [strengthOptions, setStrengthOptions] = useState([]); const [flavorOptions, setFlavorOptions] = useState([]); + const [humidityOptions, setHumidityOptions] = useState<{ label: string; value: string }[]>([]); + const [components, setComponents] = useState<{ stockId: number; quantity: number }[]>([]); const setInitialIds = () => { - const brand = brandOptions.find((item) => item.title === record.brandName); - const strength = strengthOptions.find((item) => item.title === record.strengthName); - const flavor = flavorOptions.find((item) => item.title === record.flavorsName); + const brand = brandOptions.find((item) => item.title === record.brand.name); + const strength = strengthOptions.find((item) => item.title === record.strength.name); + const flavor = flavorOptions.find((item) => item.title === record.flavors.name); formRef.current?.setFieldsValue({ brandId: brand?.id, strengthId: strength?.id, @@ -450,6 +471,21 @@ const EditForm: React.FC<{ } }, [brandOptions, strengthOptions, flavorOptions]); + React.useEffect(() => { + // 中文注释:加载干湿选项 + (async () => { + const { data = [] } = await productcontrollerGetattributeall({ dictName: 'humidity' } as any); + setHumidityOptions((data || []).map((i: any) => ({ label: i.name, value: i.name }))); + })(); + // 中文注释:加载当前产品的组成 + (async () => { + const { data = [] } = await productcontrollerGetproductcomponents({ id: (record as any).id }); + const items = (data || []).map((c: any) => ({ stockId: c.stockId, quantity: c.quantity })); + setComponents(items); + formRef.current?.setFieldsValue({ components: items }); + })(); + }, []); + return ( formRef={formRef} @@ -462,13 +498,37 @@ const EditForm: React.FC<{ humidity: record.humidity, price: (record as any).price, promotionPrice: (record as any).promotionPrice, + components, }} onFinish={async (values) => { + // 中文注释:组装 attributes(若选择了则发送) + const attrs = [ + values.brandId ? { id: values.brandId } : null, + values.strengthId ? { id: values.strengthId } : null, + values.flavorsId ? { id: values.flavorsId } : null, + values.humidity ? { dictName: 'humidity', name: values.humidity } : null, + ].filter(Boolean); + const updatePayload: any = { + name: values.name, + sku: values.sku, + description: values.description, + price: values.price, + promotionPrice: values.promotionPrice, + ...(attrs.length ? { attributes: attrs } : {}), + }; const { success, message: errMsg } = await productcontrollerUpdateproduct( - { id: record.id }, - values as any, + { id: (record as any).id }, + updatePayload, ); if (success) { + // 中文注释:同步更新组成(覆盖式) + const items = (values as any)?.components || []; + if (Array.isArray(items)) { + const payloadItems = items + .filter((i: any) => i && i.stockId && i.quantity && i.quantity > 0) + .map((i: any) => ({ stockId: Number(i.stockId), quantity: Number(i.quantity) })); + await productcontrollerSetproductcomponents({ id: (record as any).id }, { items: payloadItems }); + } message.success('更新成功'); tableRef.current?.reloadAndRest?.(); return true; @@ -477,62 +537,7 @@ const EditForm: React.FC<{ return false; }} > - { - const { data = [] } = await productcontrollerGetbrandall(); - setBrandOptions(data); - return data.map((item: DictItem) => ({ - label: item.name, - value: item.id, - })); - }} - rules={[{ required: true, message: '请选择产品品牌' }]} - /> - { - const { data = [] } = await productcontrollerGetstrengthall(); - setStrengthOptions(data); - return data.map((item: DictItem) => ({ - label: item.name, - value: item.id, - })); - }} - rules={[{ required: true, message: '请选择强度' }]} - /> - { - const { data = [] } = await productcontrollerGetflavorsall(); - setFlavorOptions(data); - return data.map((item: DictItem) => ({ - label: item.name, - value: item.id, - })); - }} - rules={[{ required: true, message: '请选择口味' }]} - /> - + {/* 在这里列举attribute字段 */} + { + const { data = [] } = await productcontrollerCompatbrandall(); + setBrandOptions(data); + return data.map((item: DictItem) => ({ label: item.name, value: item.id })); + }} + /> + { + const { data = [] } = await productcontrollerCompatstrengthall(); + setStrengthOptions(data); + return data.map((item: DictItem) => ({ label: item.name, value: item.id })); + }} + /> + { + const { data = [] } = await productcontrollerCompatflavorsall(); + setFlavorOptions(data); + return data.map((item: DictItem) => ({ label: item.name, value: item.id })); + }} + /> + + + {/* 中文注释:编辑产品组成(库存ID + 数量) */} + + + ( +
+ {listDom} + {action} +
+ )} + > + + + + +
); }; diff --git a/src/pages/Product/Strength/index.tsx b/src/pages/Product/Strength/index.tsx deleted file mode 100644 index 6fbfd8e..0000000 --- a/src/pages/Product/Strength/index.tsx +++ /dev/null @@ -1,206 +0,0 @@ -import { - productcontrollerCreatestrength, - productcontrollerDeletestrength, - productcontrollerGetstrength, -} from '@/servers/api/product'; -import { PlusOutlined } from '@ant-design/icons'; -import { - ActionType, - DrawerForm, - PageContainer, - ProColumns, - ProFormText, - ProTable, -} from '@ant-design/pro-components'; -import { App, Button, Popconfirm } from 'antd'; -import { useRef } from 'react'; - -const List: React.FC = () => { - const actionRef = useRef(); - const { message } = App.useApp(); - const columns: ProColumns[] = [ - { - title: '名称', - dataIndex: 'name', - tip: '名称是唯一的 key', - formItemProps: { - rules: [ - { - required: true, - message: '名称为必填项', - }, - ], - }, - }, - { - title: '标识', - dataIndex: 'unique_key', - hideInSearch: true, - }, - { - title: '更新时间', - dataIndex: 'updatedAt', - valueType: 'dateTime', - hideInSearch: true, - }, - { - title: '创建时间', - dataIndex: 'createdAt', - valueType: 'dateTime', - hideInSearch: true, - }, - { - title: '操作', - dataIndex: 'option', - valueType: 'option', - render: (_, record) => ( - <> - {/* - */} - { - try { - const { success, message: errMsg } = - await productcontrollerDeletestrength({ id: record.id }); - if (!success) { - throw new Error(errMsg); - } - actionRef.current?.reload(); - } catch (error: any) { - message.error(error.message); - } - }} - > - - - - ), - }, - ]; - - return ( - - - headerTitle="查询表格" - actionRef={actionRef} - rowKey="id" - toolBarRender={() => []} - request={async (params) => { - const { data, success } = await productcontrollerGetstrength(params); - return { - total: data?.total || 0, - data: data?.items || [], - success, - }; - }} - columns={columns} - /> - - ); -}; - -const CreateForm: React.FC<{ - tableRef: React.MutableRefObject; -}> = ({ tableRef }) => { - const { message } = App.useApp(); - return ( - - title="新建" - trigger={ - - } - autoFocusFirstInput - drawerProps={{ - destroyOnHidden: true, - }} - onFinish={async (values) => { - try { - const { success, message: errMsg } = - await productcontrollerCreatestrength(values); - if (!success) { - throw new Error(errMsg); - } - tableRef.current?.reload(); - message.success('提交成功'); - return true; - } catch (error: any) { - message.error(error.message); - } - }} - > - - - - ); -}; - -// const UpdateForm: React.FC<{ -// tableRef: React.MutableRefObject; -// values: API.Category; -// }> = ({ tableRef, values: initialValues }) => { -// const { message } = App.useApp(); -// return ( -// -// title="编辑" -// initialValues={initialValues} -// trigger={ -// -// } -// autoFocusFirstInput -// drawerProps={{ -// destroyOnHidden: true, -// }} -// onFinish={async (values) => { -// try { -// const { success, message: errMsg } = -// await productcontrollerUpdatestrength( -// { id: initialValues.id }, -// values, -// ); -// if (!success) { -// throw new Error(errMsg); -// } -// message.success('提交成功'); -// tableRef.current?.reload(); -// return true; -// } catch (error: any) { -// message.error(error.message); -// } -// }} -// > -// -// -// -// -// ); -// }; - -export default List; diff --git a/src/servers/api/product.ts b/src/servers/api/product.ts index 2b4a032..ad3c15d 100644 --- a/src/servers/api/product.ts +++ b/src/servers/api/product.ts @@ -50,46 +50,30 @@ export async function productcontrollerDeleteproduct( }); } -/** 此处后端没有提供注释 POST /product/batchSetSku */ -export async function productcontrollerBatchsetsku( - body: API.BatchSetSkuDTO, - options?: { [key: string]: any }, -) { - return request('/product/batchSetSku', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - data: body, - ...(options || {}), - }); -} - -/** 此处后端没有提供注释 POST /product/brand */ -export async function productcontrollerCreatebrand( - body: API.CreateBrandDTO, - options?: { [key: string]: any }, -) { - return request('/product/brand', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - data: body, - ...(options || {}), - }); -} - -/** 此处后端没有提供注释 PUT /product/brand/${param0} */ -export async function productcontrollerUpdatebrand( +/** 此处后端没有提供注释 GET /product/${param0}/components */ +export async function productcontrollerGetproductcomponents( // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.productcontrollerUpdatebrandParams, - body: API.UpdateBrandDTO, + params: API.productcontrollerGetproductcomponentsParams, options?: { [key: string]: any }, ) { const { id: param0, ...queryParams } = params; - return request(`/product/brand/${param0}`, { - method: 'PUT', + return request(`/product/${param0}/components`, { + method: 'GET', + params: { ...queryParams }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 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', }, @@ -99,10 +83,147 @@ export async function productcontrollerUpdatebrand( }); } -/** 此处后端没有提供注释 DELETE /product/brand/${param0} */ -export async function productcontrollerDeletebrand( +/** 此处后端没有提供注释 POST /product/${param0}/components/auto */ +export async function productcontrollerAutobindcomponents( // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.productcontrollerDeletebrandParams, + params: API.productcontrollerAutobindcomponentsParams, + options?: { [key: string]: any }, +) { + const { id: param0, ...queryParams } = params; + return request(`/product/${param0}/components/auto`, { + method: 'POST', + params: { ...queryParams }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 GET /product/attribute */ +export async function productcontrollerGetattributelist( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.productcontrollerGetattributelistParams, + options?: { [key: string]: any }, +) { + return request('/product/attribute', { + method: 'GET', + params: { + ...params, + pageSize: undefined, + ...params['pageSize'], + current: undefined, + ...params['current'], + }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 POST /product/attribute */ +export async function productcontrollerCreateattribute( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.productcontrollerCreateattributeParams, + body: Record, + options?: { [key: string]: any }, +) { + return request('/product/attribute', { + method: 'POST', + headers: { + 'Content-Type': 'text/plain', + }, + params: { + ...params, + }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 PUT /product/attribute/${param0} */ +export async function productcontrollerUpdateattribute( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.productcontrollerUpdateattributeParams, + body: Record, + options?: { [key: string]: any }, +) { + const { id: param0, ...queryParams } = params; + return request(`/product/attribute/${param0}`, { + method: 'PUT', + headers: { + 'Content-Type': 'text/plain', + }, + params: { + ...queryParams, + }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 DELETE /product/attribute/${param0} */ +export async function productcontrollerDeleteattribute( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.productcontrollerDeleteattributeParams, + options?: { [key: string]: any }, +) { + const { id: param0, ...queryParams } = params; + return request(`/product/attribute/${param0}`, { + method: 'DELETE', + params: { ...queryParams }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 GET /product/attributeAll */ +export async function productcontrollerGetattributeall( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.productcontrollerGetattributeallParams, + options?: { [key: string]: any }, +) { + return request('/product/attributeAll', { + method: 'GET', + params: { + ...params, + }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 POST /product/brand */ +export async function productcontrollerCompatcreatebrand( + body: Record, + options?: { [key: string]: any }, +) { + return request('/product/brand', { + method: 'POST', + headers: { + 'Content-Type': 'text/plain', + }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 PUT /product/brand/${param0} */ +export async function productcontrollerCompatupdatebrand( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.productcontrollerCompatupdatebrandParams, + body: Record, + options?: { [key: string]: any }, +) { + const { id: param0, ...queryParams } = params; + return request(`/product/brand/${param0}`, { + method: 'PUT', + headers: { + 'Content-Type': 'text/plain', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 DELETE /product/brand/${param0} */ +export async function productcontrollerCompatdeletebrand( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.productcontrollerCompatdeletebrandParams, options?: { [key: string]: any }, ) { const { id: param0, ...queryParams } = params; @@ -114,7 +235,7 @@ export async function productcontrollerDeletebrand( } /** 此处后端没有提供注释 GET /product/brandAll */ -export async function productcontrollerGetbrandall(options?: { +export async function productcontrollerCompatbrandall(options?: { [key: string]: any; }) { return request('/product/brandAll', { @@ -124,44 +245,52 @@ export async function productcontrollerGetbrandall(options?: { } /** 此处后端没有提供注释 GET /product/brands */ -export async function productcontrollerGetbrands( +export async function productcontrollerCompatbrands( // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.productcontrollerGetbrandsParams, + params: API.productcontrollerCompatbrandsParams, options?: { [key: string]: any }, ) { - return request('/product/brands', { + return request('/product/brands', { method: 'GET', params: { ...params, + pageSize: undefined, + ...params['pageSize'], + current: undefined, + ...params['current'], }, ...(options || {}), }); } /** 此处后端没有提供注释 GET /product/flavors */ -export async function productcontrollerGetflavors( +export async function productcontrollerCompatflavors( // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.productcontrollerGetflavorsParams, + params: API.productcontrollerCompatflavorsParams, options?: { [key: string]: any }, ) { return request('/product/flavors', { method: 'GET', params: { ...params, + pageSize: undefined, + ...params['pageSize'], + current: undefined, + ...params['current'], }, ...(options || {}), }); } /** 此处后端没有提供注释 POST /product/flavors */ -export async function productcontrollerCreateflavors( - body: API.CreateFlavorsDTO, +export async function productcontrollerCompatcreateflavors( + body: Record, options?: { [key: string]: any }, ) { return request('/product/flavors', { method: 'POST', headers: { - 'Content-Type': 'application/json', + 'Content-Type': 'text/plain', }, data: body, ...(options || {}), @@ -169,17 +298,17 @@ export async function productcontrollerCreateflavors( } /** 此处后端没有提供注释 PUT /product/flavors/${param0} */ -export async function productcontrollerUpdateflavors( +export async function productcontrollerCompatupdateflavors( // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.productcontrollerUpdateflavorsParams, - body: API.UpdateFlavorsDTO, + params: API.productcontrollerCompatupdateflavorsParams, + body: Record, options?: { [key: string]: any }, ) { const { id: param0, ...queryParams } = params; return request(`/product/flavors/${param0}`, { method: 'PUT', headers: { - 'Content-Type': 'application/json', + 'Content-Type': 'text/plain', }, params: { ...queryParams }, data: body, @@ -188,9 +317,9 @@ export async function productcontrollerUpdateflavors( } /** 此处后端没有提供注释 DELETE /product/flavors/${param0} */ -export async function productcontrollerDeleteflavors( +export async function productcontrollerCompatdeleteflavors( // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.productcontrollerDeleteflavorsParams, + params: API.productcontrollerCompatdeleteflavorsParams, options?: { [key: string]: any }, ) { const { id: param0, ...queryParams } = params; @@ -202,7 +331,7 @@ export async function productcontrollerDeleteflavors( } /** 此处后端没有提供注释 GET /product/flavorsAll */ -export async function productcontrollerGetflavorsall(options?: { +export async function productcontrollerCompatflavorsall(options?: { [key: string]: any; }) { return request('/product/flavorsAll', { @@ -241,6 +370,83 @@ export async function productcontrollerSearchproducts( }); } +/** 此处后端没有提供注释 GET /product/size */ +export async function productcontrollerCompatsize( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.productcontrollerCompatsizeParams, + options?: { [key: string]: any }, +) { + return request('/product/size', { + method: 'GET', + params: { + ...params, + pageSize: undefined, + ...params['pageSize'], + current: undefined, + ...params['current'], + }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 POST /product/size */ +export async function productcontrollerCompatcreatesize( + body: Record, + options?: { [key: string]: any }, +) { + return request('/product/size', { + method: 'POST', + headers: { + 'Content-Type': 'text/plain', + }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 PUT /product/size/${param0} */ +export async function productcontrollerCompatupdatesize( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.productcontrollerCompatupdatesizeParams, + body: Record, + options?: { [key: string]: any }, +) { + const { id: param0, ...queryParams } = params; + return request(`/product/size/${param0}`, { + method: 'PUT', + headers: { + 'Content-Type': 'text/plain', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 DELETE /product/size/${param0} */ +export async function productcontrollerCompatdeletesize( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.productcontrollerCompatdeletesizeParams, + options?: { [key: string]: any }, +) { + const { id: param0, ...queryParams } = params; + return request(`/product/size/${param0}`, { + method: 'DELETE', + params: { ...queryParams }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 GET /product/sizeAll */ +export async function productcontrollerCompatsizeall(options?: { + [key: string]: any; +}) { + return request('/product/sizeAll', { + method: 'GET', + ...(options || {}), + }); +} + /** 此处后端没有提供注释 GET /product/sku/${param0} */ export async function productcontrollerProductbysku( // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) @@ -256,29 +462,33 @@ export async function productcontrollerProductbysku( } /** 此处后端没有提供注释 GET /product/strength */ -export async function productcontrollerGetstrength( +export async function productcontrollerCompatstrength( // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.productcontrollerGetstrengthParams, + params: API.productcontrollerCompatstrengthParams, options?: { [key: string]: any }, ) { return request('/product/strength', { method: 'GET', params: { ...params, + pageSize: undefined, + ...params['pageSize'], + current: undefined, + ...params['current'], }, ...(options || {}), }); } /** 此处后端没有提供注释 POST /product/strength */ -export async function productcontrollerCreatestrength( - body: API.CreateStrengthDTO, +export async function productcontrollerCompatcreatestrength( + body: Record, options?: { [key: string]: any }, ) { return request('/product/strength', { method: 'POST', headers: { - 'Content-Type': 'application/json', + 'Content-Type': 'text/plain', }, data: body, ...(options || {}), @@ -286,17 +496,17 @@ export async function productcontrollerCreatestrength( } /** 此处后端没有提供注释 PUT /product/strength/${param0} */ -export async function productcontrollerUpdatestrength( +export async function productcontrollerCompatupdatestrength( // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.productcontrollerUpdatestrengthParams, - body: API.UpdateStrengthDTO, + params: API.productcontrollerCompatupdatestrengthParams, + body: Record, options?: { [key: string]: any }, ) { const { id: param0, ...queryParams } = params; return request(`/product/strength/${param0}`, { method: 'PUT', headers: { - 'Content-Type': 'application/json', + 'Content-Type': 'text/plain', }, params: { ...queryParams }, data: body, @@ -305,9 +515,9 @@ export async function productcontrollerUpdatestrength( } /** 此处后端没有提供注释 DELETE /product/strength/${param0} */ -export async function productcontrollerDeletestrength( +export async function productcontrollerCompatdeletestrength( // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.productcontrollerDeletestrengthParams, + params: API.productcontrollerCompatdeletestrengthParams, options?: { [key: string]: any }, ) { const { id: param0, ...queryParams } = params; @@ -319,7 +529,7 @@ export async function productcontrollerDeletestrength( } /** 此处后端没有提供注释 GET /product/strengthAll */ -export async function productcontrollerGetstrengthall(options?: { +export async function productcontrollerCompatstrengthall(options?: { [key: string]: any; }) { return request('/product/strengthAll', { diff --git a/src/servers/api/typings.d.ts b/src/servers/api/typings.d.ts index 0ecd7f2..f851ab8 100644 --- a/src/servers/api/typings.d.ts +++ b/src/servers/api/typings.d.ts @@ -11,6 +11,10 @@ declare namespace API { id?: number; /** 区域名称 */ name?: string; + /** 纬度 */ + latitude?: number; + /** 经度 */ + longitude?: number; /** 创建时间 */ createdAt: string; /** 更新时间 */ @@ -38,11 +42,6 @@ declare namespace API { id: number; }; - type BatchSetSkuDTO = { - /** sku 数据列表 */ - skus?: SkuItemDTO[]; - }; - type BooleanRes = { /** 状态码 */ code?: number; @@ -54,40 +53,19 @@ declare namespace API { data?: boolean; }; - type BrandPaginatedResponse = { - /** 当前页码 */ - page?: number; - /** 每页大小 */ - pageSize?: number; - /** 总记录数 */ - total?: number; - /** 数据列表 */ - items?: Dict[]; - }; - type CreateAreaDTO = { /** 区域名称 */ name?: string; - }; - - type CreateBrandDTO = { - /** 品牌名称 */ - title: string; - /** 品牌唯一标识 */ - name: string; + /** 纬度 */ + latitude?: number; + /** 经度 */ + longitude?: number; }; type CreateDictDTO = {}; type CreateDictItemDTO = {}; - type CreateFlavorsDTO = { - /** 口味名称 */ - title: string; - /** 口味唯一标识 */ - name: string; - }; - type CreateOrderNoteDTO = { orderId?: number; content?: string; @@ -100,15 +78,12 @@ declare namespace API { description?: string; /** 产品 SKU */ sku?: string; - /** 品牌 ID */ - brandId?: number; - /** 规格 ID */ - strengthId?: number; - /** 口味 ID */ - flavorsId?: number; - humidity?: string; + /** 属性列表 */ + attributes?: any[]; /** 价格 */ price?: number; + /** 促销价格 */ + promotionPrice?: number; }; type CreatePurchaseOrderDTO = { @@ -128,13 +103,6 @@ declare namespace API { contactPhone?: string; }; - type CreateStrengthDTO = { - /** 规格名称 */ - title?: string; - /** 规格唯一标识 */ - name: string; - }; - type CreateTemplateDTO = { /** 模板名称 */ name: string; @@ -182,8 +150,6 @@ declare namespace API { SignatureRequirementEnum?: any; }; - type Dict = {}; - type dictcontrollerDeletedictitemParams = { id: number; }; @@ -734,10 +700,14 @@ declare namespace API { sku?: string; /** 价格 */ price?: number; + /** 类型 */ + type?: string; /** 促销价格 */ promotionPrice?: number; /** 库存 */ stock?: number; + /** 库存组成 */ + components?: ProductStockComponent[]; /** 来源 */ source?: number; /** 创建时间 */ @@ -746,33 +716,78 @@ declare namespace API { updatedAt: string; }; - type ProductBrandListRes = { - /** 状态码 */ - code?: number; - /** 是否成功 */ - success?: boolean; - /** 消息内容 */ - message?: string; - /** 响应数据 */ - data?: BrandPaginatedResponse; + type ProductComponentItemDTO = { + /** 库存记录ID */ + stockId?: number; + /** 组成数量 */ + quantity?: number; }; - type ProductBrandRes = { - /** 状态码 */ - code?: number; - /** 是否成功 */ - success?: boolean; - /** 消息内容 */ - message?: string; - /** 响应数据 */ - data?: Dict; - }; - - type productcontrollerDeletebrandParams = { + type productcontrollerAutobindcomponentsParams = { id: number; }; - type productcontrollerDeleteflavorsParams = { + type productcontrollerCompatbrandsParams = { + name?: string; + pageSize?: Record; + current?: Record; + }; + + type productcontrollerCompatdeletebrandParams = { + id: number; + }; + + type productcontrollerCompatdeleteflavorsParams = { + id: number; + }; + + type productcontrollerCompatdeletesizeParams = { + id: number; + }; + + type productcontrollerCompatdeletestrengthParams = { + id: number; + }; + + type productcontrollerCompatflavorsParams = { + name?: string; + pageSize?: Record; + current?: Record; + }; + + type productcontrollerCompatsizeParams = { + name?: string; + pageSize?: Record; + current?: Record; + }; + + type productcontrollerCompatstrengthParams = { + name?: string; + pageSize?: Record; + current?: Record; + }; + + type productcontrollerCompatupdatebrandParams = { + id: number; + }; + + type productcontrollerCompatupdateflavorsParams = { + id: number; + }; + + type productcontrollerCompatupdatesizeParams = { + id: number; + }; + + type productcontrollerCompatupdatestrengthParams = { + id: number; + }; + + type productcontrollerCreateattributeParams = { + dictName?: string; + }; + + type productcontrollerDeleteattributeParams = { id: number; }; @@ -780,28 +795,21 @@ declare namespace API { id: number; }; - type productcontrollerDeletestrengthParams = { + type productcontrollerGetattributeallParams = { + dictName?: string; + }; + + type productcontrollerGetattributelistParams = { + name?: string; + pageSize?: Record; + current?: Record; + dictName?: string; + }; + + type productcontrollerGetproductcomponentsParams = { id: number; }; - type productcontrollerGetbrandsParams = { - /** 页码 */ - current?: number; - /** 每页大小 */ - pageSize?: number; - /** 关键字 */ - name?: string; - }; - - type productcontrollerGetflavorsParams = { - /** 页码 */ - current?: number; - /** 每页大小 */ - pageSize?: number; - /** 关键字 */ - name?: string; - }; - type productcontrollerGetproductlistParams = { /** 页码 */ current?: number; @@ -813,15 +821,6 @@ declare namespace API { brandId?: number; }; - type productcontrollerGetstrengthParams = { - /** 页码 */ - current?: number; - /** 每页大小 */ - pageSize?: number; - /** 关键字 */ - name?: string; - }; - type productcontrollerProductbyskuParams = { sku: string; }; @@ -830,11 +829,12 @@ declare namespace API { name?: string; }; - type productcontrollerUpdatebrandParams = { + type productcontrollerSetproductcomponentsParams = { id: number; }; - type productcontrollerUpdateflavorsParams = { + type productcontrollerUpdateattributeParams = { + dictName?: string; id: number; }; @@ -847,10 +847,6 @@ declare namespace API { id: number; }; - type productcontrollerUpdatestrengthParams = { - id: number; - }; - type ProductListRes = { /** 状态码 */ code?: number; @@ -895,6 +891,18 @@ declare namespace API { data?: Product[]; }; + type ProductStockComponent = { + id?: number; + productId?: number; + stockId?: number; + /** 组成数量 */ + quantity?: number; + /** 创建时间 */ + createdAt?: string; + /** 更新时间 */ + updatedAt?: string; + }; + type PurchaseOrderDTO = { id?: number; stockPointId?: number; @@ -950,15 +958,6 @@ declare namespace API { name?: string; }; - type QueryBrandDTO = { - /** 页码 */ - current?: number; - /** 每页大小 */ - pageSize?: number; - /** 关键字 */ - name?: string; - }; - type QueryCustomerListDTO = { current?: string; pageSize?: string; @@ -971,15 +970,6 @@ declare namespace API { customerId?: number; }; - type QueryFlavorsDTO = { - /** 页码 */ - current?: number; - /** 每页大小 */ - pageSize?: number; - /** 关键字 */ - name?: string; - }; - type QueryOrderDTO = { /** 页码 */ current?: number; @@ -1095,15 +1085,6 @@ declare namespace API { endDate?: string; }; - type QueryStrengthDTO = { - /** 页码 */ - current?: number; - /** 每页大小 */ - pageSize?: number; - /** 关键字 */ - name?: string; - }; - type QuerySubscriptionDTO = { /** 页码 */ current?: number; @@ -1198,6 +1179,11 @@ declare namespace API { constitution?: { sku?: string; quantity?: number }[]; }; + type SetProductComponentsDTO = { + /** 组成项列表 */ + items?: ProductComponentItemDTO[]; + }; + type ShipmentBookDTO = { sales?: OrderSale[]; details?: ShippingDetailsDTO; @@ -1273,7 +1259,7 @@ declare namespace API { /** 站点 rest 秘钥 */ consumerSecret?: string; /** 站点名 */ - siteName?: string; + name?: string; /** 平台类型 */ type?: 'woocommerce' | 'shopyy'; /** SKU 前缀 */ @@ -1292,13 +1278,6 @@ declare namespace API { id: string; }; - type SkuItemDTO = { - /** 产品 ID */ - productId?: number; - /** sku 编码 */ - sku?: string; - }; - type statisticscontrollerGetinativeusersbymonthParams = { month?: string; }; @@ -1616,26 +1595,16 @@ declare namespace API { type UpdateAreaDTO = { /** 区域名称 */ name?: string; - }; - - type UpdateBrandDTO = { - /** 品牌名称 */ - title?: string; - /** 品牌唯一标识 */ - name?: string; + /** 纬度 */ + latitude?: number; + /** 经度 */ + longitude?: number; }; type UpdateDictDTO = {}; type UpdateDictItemDTO = {}; - type UpdateFlavorsDTO = { - /** 口味名称 */ - title?: string; - /** 口味唯一标识 */ - name?: string; - }; - type UpdateProductDTO = { /** 产品名称 */ name?: string; @@ -1643,15 +1612,12 @@ declare namespace API { description?: string; /** 产品 SKU */ sku?: string; - /** 品牌 ID */ - brandId?: number; - /** 规格 ID */ - strengthId?: number; - /** 口味 ID */ - flavorsId?: number; - humidity?: string; /** 价格 */ price?: number; + /** 促销价格 */ + promotionPrice?: number; + /** 属性列表 */ + attributes?: any[]; }; type UpdatePurchaseOrderDTO = { @@ -1680,13 +1646,6 @@ declare namespace API { contactPhone?: string; }; - type UpdateStrengthDTO = { - /** 规格名称 */ - title?: string; - /** 规格唯一标识 */ - name?: string; - }; - type UpdateTemplateDTO = { /** 模板名称 */ name: string; @@ -1720,6 +1679,10 @@ declare namespace API { on_sale?: boolean; }; + type usercontrollerUpdateuserParams = { + id?: number; + }; + type VariationDTO = { /** ID */ id: number; diff --git a/src/servers/api/user.ts b/src/servers/api/user.ts index 60679d7..8720471 100644 --- a/src/servers/api/user.ts +++ b/src/servers/api/user.ts @@ -72,3 +72,24 @@ export async function usercontrollerToggleactive( ...(options || {}), }); } + +/** 此处后端没有提供注释 POST /user/update/${param0} */ +export async function usercontrollerUpdateuser( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.usercontrollerUpdateuserParams, + body: Record, + options?: { [key: string]: any }, +) { + const { id: param0, ...queryParams } = params; + return request(`/user/update/${param0}`, { + method: 'POST', + headers: { + 'Content-Type': 'text/plain', + }, + params: { + ...queryParams, + }, + data: body, + ...(options || {}), + }); +}