perf: 优化

This commit is contained in:
ah--desktop
2025-12-07 23:36:38 +08:00
parent 407c650973
commit a3b8797955
42 changed files with 160 additions and 701 deletions
@@ -1,135 +0,0 @@
import type { ProductDTO, ProductVO } from './types';
import type { PageQueryDTO, PageResultVO } from '#/types/common';
import { requestClient } from '#/api/request';
/**
* 商品管理API
*/
/**
* 分页获取商品列表
*/
export async function getProductPageApi(
params: PageQueryDTO<ProductDTO.Filters>,
) {
return requestClient.post<PageResultVO<ProductVO.Info>>(
'/ec/product/page',
params,
);
}
/**
* 创建商品
*/
export async function createProductApi(data: ProductDTO.Create) {
return requestClient.post<ProductVO.Info>('/ec/product/create', data);
}
/**
* 更新商品
*/
export async function updateProductApi(id: number, data: ProductDTO.Update) {
return requestClient.put<ProductVO.Info>(`/ec/product/update/${id}`, data);
}
/**
* 删除商品
*/
export async function deleteProductApi(id: number) {
return requestClient.delete(`/ec/product/delete/${id}`);
}
/**
* 商品规格管理API
*/
/**
* 分页获取商品规格列表
*/
export async function getProductSpecPageApi(
params: PageQueryDTO<ProductDTO.SpecFilters>,
) {
return requestClient.post<PageResultVO<ProductVO.SpecInfo>>(
'/ec/product-spec/page',
params,
);
}
/**
* 创建商品规格
*/
export async function createProductSpecApi(data: ProductDTO.CreateSpec) {
return requestClient.post<ProductVO.SpecInfo>(
'/ec/product-spec/create',
data,
);
}
/**
* 更新商品规格
*/
export async function updateProductSpecApi(
id: number,
data: ProductDTO.UpdateSpec,
) {
return requestClient.put<ProductVO.SpecInfo>(
`/ec/product-spec/update/${id}`,
data,
);
}
/**
* 删除商品规格
*/
export async function deleteProductSpecApi(id: number) {
return requestClient.delete(`/ec/product-spec/delete/${id}`);
}
/**
* 精准查询API - 用于数据导入
*/
/**
* 根据名称精准查询商品
*/
export async function getProductByNameApi(name: string) {
return requestClient.get<ProductVO.Info>(
`/ec/product/find-by-name/${encodeURIComponent(name)}`,
);
}
/**
* 批量根据名称查询商品
*/
export async function getProductsByNamesApi(names: string[]) {
return requestClient.post<ProductVO.Info[]>(
'/ec/product/find-by-names',
names,
);
}
/**
* 根据商品名称和规格编码精准查询商品规格
*/
export async function getProductSpecByProductAndSpecApi(
productName: string,
specCode: string,
) {
return requestClient.get<ProductVO.SpecInfo>(
`/ec/product-spec/find-by-product-and-spec/${encodeURIComponent(productName)}/${encodeURIComponent(specCode)}`,
);
}
/**
* 批量根据商品名称和规格编码查询商品规格
*/
export async function getProductSpecsByProductAndSpecsApi(
queries: { productName: string; specCode: string }[],
) {
return requestClient.post<ProductVO.Info[]>(
'/ec/product-spec/find-by-product-and-specs',
queries,
);
}
@@ -1 +0,0 @@
export * from './apis';
@@ -1,2 +0,0 @@
export * from './types.dto';
export * from './types.vo';
@@ -1,97 +0,0 @@
/**
* 商品相关DTO类型定义
*/
export namespace ProductDTO {
/** 创建商品参数 */
export interface Create {
/** 商品名称 */
name: string;
/** 商品编码 */
productCode?: string;
/** 主图图片ID */
mainImageId?: number;
/** 商品规格列表(可选) */
specs?: Spec[];
}
/** 更新商品参数 */
export interface Update {
/** 商品名称 */
name: string;
/** 商品编码 */
productCode?: string;
/** 商品编码 */
specCode?: string;
/** 商品SKU */
skuCode?: string;
/** 主图图片ID */
mainImageId?: number;
/** 成本价 */
costPrice: number;
}
/** 商品规格DTO */
export interface Spec {
/** 规格名称 */
name: string;
/** 规格编码 */
specCode?: string;
/** 成本价 */
costPrice: number;
}
/** 创建商品规格参数 */
export interface CreateSpec {
/** 商品ID */
productId: number;
/** 规格名称 */
name: string;
/** 规格编码 */
specCode?: string;
/** 成本价 */
costPrice: number;
}
/** 更新商品规格参数 */
export interface UpdateSpec {
/** 规格名称 */
name: string;
/** 规格编码 */
specCode?: string;
/** 成本价 */
costPrice: number;
}
/** 商品过滤条件 */
export interface Filters {
/** 商品名称(模糊查询) */
name?: string;
/** 商品编码(模糊查询) */
productCode?: string;
/** 商品编码(模糊查询) */
specCode?: string;
/** 商品SKU(模糊查询) */
skuCode?: string;
/** 成本价范围-最小值 */
minCostPrice?: number;
/** 成本价范围-最大值 */
maxCostPrice?: number;
}
/** 商品规格过滤条件 */
export interface SpecFilters {
/** 商品ID */
productId?: number;
/** 商品名称(模糊查询) */
productName?: string;
/** 规格名称(模糊查询) */
name?: string;
/** 规格编码(模糊查询) */
specCode?: string;
/** 成本价范围-最小值 */
minCostPrice?: number;
/** 成本价范围-最大值 */
maxCostPrice?: number;
}
}
@@ -1,57 +0,0 @@
/**
* 商品相关VO类型定义
*/
export namespace ProductVO {
/** 商品信息 */
export interface Info {
/** 商品ID */
id: number;
/** 公司ID */
companyId: number;
/** 商品名称 */
name: string;
/** 商品编码 */
productCode?: string;
/** 主图URL(冗余字段) */
mainImage?: string;
/** 主图图片ID */
mainImageId?: number;
/** 创建时间 */
createTime: string;
/** 更新时间 */
updateTime: string;
/** 创建人ID */
createBy?: number;
/** 更新人ID */
updateBy?: number;
/** 商品规格列表 */
specs?: SpecInfo[];
}
/** 商品规格信息 */
export interface SpecInfo {
/** 规格ID */
id: number;
/** 公司ID */
companyId: number;
/** 商品ID */
productId: number;
/** 商品名称 */
productName: string;
/** 规格名称 */
name: string;
/** 规格编码 */
specCode?: string;
/** 成本价 */
costPrice: number;
/** 创建时间 */
createTime: string;
/** 更新时间 */
updateTime: string;
/** 创建人ID */
createBy?: number;
/** 更新人ID */
updateBy?: number;
}
}
@@ -1,43 +0,0 @@
import { requestClient } from '#/api/request';
import type { PageQueryDTO, PageResultVO } from '#/types/common';
import type { PromotionFeeDTO, PromotionFeeVO } from './types';
/**
* 推广费管理API
*/
/**
* 分页获取推广费记录列表
*/
export async function getPromotionFeePageApi(params: PageQueryDTO<PromotionFeeDTO.Filters>) {
return requestClient.post<PageResultVO<PromotionFeeVO.Info>>('/ec/promotion-fee/page', params);
}
/**
* 创建推广费记录
*/
export async function createPromotionFeeApi(data: PromotionFeeDTO.Create) {
return requestClient.post<number>('/ec/promotion-fee', data);
}
/**
* 更新推广费记录
*/
export async function updatePromotionFeeApi(data: PromotionFeeDTO.Update) {
return requestClient.put<void>('/ec/promotion-fee', data);
}
/**
* 删除推广费记录
*/
export async function deletePromotionFeeApi(id: number) {
return requestClient.delete<void>(`/ec/promotion-fee/${id}`);
}
/**
* 获取推广费记录详情
*/
export async function getPromotionFeeByIdApi(id: number) {
return requestClient.get<PromotionFeeVO.Info>(`/ec/promotion-fee/${id}`);
}
@@ -1 +0,0 @@
export * from './apis';
@@ -1,2 +0,0 @@
export * from './types.dto';
export * from './types.vo';
@@ -1,81 +0,0 @@
/**
* 推广费管理相关DTO类型定义
*/
export namespace PromotionFeeDTO {
/** 推广费查询过滤条件 */
export interface Filters {
/** 店铺ID */
shopId?: number;
/** 推广费类型ID */
feeTypeId?: number;
/** 平台 */
platform?: string;
/** 推广费发生日期开始 */
feeDateStart?: string;
/** 推广费发生日期结束 */
feeDateEnd?: string;
}
/** 创建推广费记录 */
export interface Create {
/** 店铺ID */
shopId: number;
/** 推广费类型ID */
feeTypeId: number;
/** 推广费名称 */
feeName: string;
/** 平台(淘宝、京东、拼多多等) */
platform?: string;
/** 推广活动名称 */
campaignName?: string;
/** 推广费金额 */
feeAmount: number;
/** 基础金额(用于按比例计算) */
baseAmount?: number;
/** 费率(用于按比例计算) */
feeRate?: number;
/** 点击次数 */
clickCount?: number;
/** 展示次数 */
impressionCount?: number;
/** 转化次数 */
conversionCount?: number;
/** 推广费发生日期 */
feeDate: string;
/** 备注 */
remark?: string;
}
/** 更新推广费记录 */
export interface Update {
/** 推广费记录ID */
id: number;
/** 店铺ID */
shopId: number;
/** 推广费类型ID */
feeTypeId: number;
/** 推广费名称 */
feeName: string;
/** 平台(淘宝、京东、拼多多等) */
platform?: string;
/** 推广活动名称 */
campaignName?: string;
/** 推广费金额 */
feeAmount: number;
/** 基础金额(用于按比例计算) */
baseAmount?: number;
/** 费率(用于按比例计算) */
feeRate?: number;
/** 点击次数 */
clickCount?: number;
/** 展示次数 */
impressionCount?: number;
/** 转化次数 */
conversionCount?: number;
/** 推广费发生日期 */
feeDate: string;
/** 备注 */
remark?: string;
}
}
@@ -1,51 +0,0 @@
/**
* 推广费管理相关VO类型定义
*/
export namespace PromotionFeeVO {
/** 推广费记录信息 */
export interface Info {
/** 推广费记录ID */
id: number;
/** 公司ID */
companyId: number;
/** 店铺ID */
shopId: number;
/** 店铺名称 */
shopName?: string;
/** 推广费类型ID */
feeTypeId: number;
/** 推广费类型名称 */
feeTypeName?: string;
/** 推广费名称 */
feeName: string;
/** 平台(淘宝、京东、拼多多等) */
platform?: string;
/** 推广活动名称 */
campaignName?: string;
/** 推广费金额 */
feeAmount: number;
/** 基础金额(用于按比例计算) */
baseAmount?: number;
/** 费率(用于按比例计算) */
feeRate?: number;
/** 点击次数 */
clickCount?: number;
/** 展示次数 */
impressionCount?: number;
/** 转化次数 */
conversionCount?: number;
/** 推广费发生日期 */
feeDate: string;
/** 备注 */
remark?: string;
/** 创建时间 */
createTime: string;
/** 更新时间 */
updateTime?: string;
/** 创建人ID */
createBy?: number;
/** 更新人ID */
updateBy?: number;
}
}
@@ -1,70 +0,0 @@
import type { ShopDTO, ShopVO } from './types';
import type { PageQueryDTO, PageResultVO } from '#/types/common';
import { requestClient } from '#/api/request';
/**
* 店铺管理API
*/
/**
* 分页获取店铺列表
*/
export async function getShopPageApi(params: PageQueryDTO<ShopDTO.Filters>) {
return requestClient.post<PageResultVO<ShopVO.Info>>('/ec/shop/page', params);
}
/**
* 创建店铺
*/
export async function createShopApi(data: ShopDTO.Create) {
return requestClient.post<ShopVO.Info>('/ec/shop/create', data);
}
/**
* 更新店铺
*/
export async function updateShopApi(id: number, data: ShopDTO.Update) {
return requestClient.put<ShopVO.Info>(`/ec/shop/update/${id}`, data);
}
/**
* 删除店铺
*/
export async function deleteShopApi(id: number) {
return requestClient.delete(`/ec/shop/delete/${id}`);
}
/**
* 上传店铺Logo
*/
export async function uploadShopLogoApi(file: File) {
const formData = new FormData();
formData.append('file', file);
return requestClient.post<ShopVO.Info>('/ec/shop/upload-logo', formData, {
headers: {
'Content-Type': 'multipart/form-data',
},
});
}
/**
* 精准查询API - 用于数据导入
*/
/**
* 根据名称精准查询店铺
*/
export async function getShopByNameApi(name: string) {
return requestClient.get<ShopVO.Info>(
`/ec/shop/find-by-name/${encodeURIComponent(name)}`,
);
}
/**
* 批量根据名称查询店铺
*/
export async function getShopsByNamesApi(names: string[]) {
return requestClient.post<ShopVO.Info[]>('/ec/shop/find-by-names', names);
}
@@ -1 +0,0 @@
export * from './apis';
@@ -1,2 +0,0 @@
export * from './types.dto';
export * from './types.vo';
@@ -1,33 +0,0 @@
/**
* 店铺相关DTO类型定义
*/
export namespace ShopDTO {
/** 创建店铺参数 */
export interface Create {
/** 店铺名称 */
name: string;
/** logo图片ID */
logoImageId?: number;
/** 平台(如淘宝、京东、拼多多) */
platform?: string;
}
/** 更新店铺参数 */
export interface Update {
/** 店铺名称 */
name: string;
/** logo图片ID */
logoImageId?: number;
/** 平台(如淘宝、京东、拼多多) */
platform?: string;
}
/** 店铺过滤条件 */
export interface Filters {
/** 店铺名称(模糊查询) */
name?: string;
/** 平台 */
platform?: string;
}
}
@@ -1,29 +0,0 @@
/**
* 店铺相关VO类型定义
*/
export namespace ShopVO {
/** 店铺信息 */
export interface Info {
/** 店铺ID */
id: number;
/** 所属公司ID */
companyId: number;
/** 店铺名称 */
name: string;
/** logo URL(冗余字段) */
logo?: string;
/** logo图片ID */
logoImageId?: number;
/** 平台(如淘宝、京东、拼多多) */
platform?: string;
/** 创建时间 */
createTime: string;
/** 更新时间 */
updateTime: string;
/** 创建人ID */
createBy?: number;
/** 更新人ID */
updateBy?: number;
}
}