zksu
/
API
forked from yoone/API
1
0
Fork 0

Compare commits

..

5 Commits

Author SHA1 Message Date
tikkhun 93931f7915 Merge branch 'main' of https://git.yoone.ca/zksu/API 2026-01-07 20:38:46 +08:00
tikkhun 9e90d5f9cf refactor(api): 统一接口参数为对象形式并支持多条件查询
重构所有接口方法,将直接传递id参数改为接受where条件对象
支持通过id、sku、email等多条件查询实体
优化产品服务逻辑,支持通过sku直接查询产品
统一各适配器实现,确保接口一致性
2026-01-07 20:33:50 +08:00
tikkhun 6311451d61 refactor(interface): 重构站点适配器接口,按功能模块组织方法
重构 ISiteAdapter 接口,将相关方法按功能模块(客户、媒体、订单、产品等)分组
移除废弃的 fulfillOrder 方法
新增多个数据映射方法以支持统一数据格式转换
2026-01-07 20:33:50 +08:00
tikkhun 5e55b85107 feat(订单): 添加获取订单总数功能
实现订单总数统计接口,包括:
1. 在ISiteAdapter接口添加countOrders方法
2. 在WooCommerce和Shopyy适配器中实现该方法
3. 添加控制器端点暴露该功能
4. 优化订单查询参数映射逻辑

refactor(Shopyy): 重构搜索参数映射逻辑

将通用的搜索参数映射逻辑提取为独立方法,提高代码复用性
2026-01-07 20:33:50 +08:00
黄珑 402ec4ceec Fix: search by phone in customers 2026-01-07 19:04:38 +08:00
1 changed files with 4 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import { Inject, Provide } from '@midwayjs/core'; import { Inject, Provide } from '@midwayjs/core';
import { InjectEntityModel } from '@midwayjs/typeorm'; import { InjectEntityModel } from '@midwayjs/typeorm';
import { Like } from 'typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { SyncOperationResult, UnifiedPaginationDTO, UnifiedSearchParamsDTO, BatchOperationResult } from '../dto/api.dto'; import { SyncOperationResult, UnifiedPaginationDTO, UnifiedSearchParamsDTO, BatchOperationResult } from '../dto/api.dto';
import { UnifiedCustomerDTO } from '../dto/site-api.dto'; import { UnifiedCustomerDTO } from '../dto/site-api.dto';
@ -372,6 +373,9 @@ export class CustomerService {
per_page = 20, per_page = 20,
where ={}, where ={},
} = params; } = params;
if (where.phone) {
where.phone = Like(`%${where.phone}%`);
}
// 查询客户列表和总数 // 查询客户列表和总数
const [customers, total] = await this.customerModel.findAndCount({ const [customers, total] = await this.customerModel.findAndCount({