From e2739e1781e9f5e8ed1f3a741530f36943c31f97 Mon Sep 17 00:00:00 2001 From: zhuotianyuan Date: Tue, 23 Sep 2025 16:32:06 +0800 Subject: [PATCH 1/3] Fix: bug fix --- src/config/config.local.ts | 8 ++++---- src/entity/order.entity.ts | 6 ++++++ src/enums/base.enum.ts | 4 ++++ src/service/authCode.service.ts | 5 +++-- tsconfig.json | 4 +++- 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/config/config.local.ts b/src/config/config.local.ts index e49f053..579f220 100644 --- a/src/config/config.local.ts +++ b/src/config/config.local.ts @@ -17,7 +17,7 @@ export default { default: { host: 'localhost', username: 'root', - password: '12345678', + password: '123456', }, }, }, @@ -35,7 +35,7 @@ export default { { id: '-1', siteName: 'Admin', - email: '444693295@qq.com', + email: '2469687281@qq.com', }, { id: '2', @@ -43,7 +43,7 @@ export default { consumerKey: 'ck_a369473a6451dbaec63d19cbfd74a074b2c5f742', consumerSecret: 'cs_0946bbbeea1bfefff08a69e817ac62a48412df8c', siteName: 'Local', - email: '444693295@qq.com', + email: '2469687281@qq.com', emailPswd: 'lulin91.', }, { @@ -52,7 +52,7 @@ export default { consumerKey: 'ck_a369473a6451dbaec63d19cbfd74a074b2c5f742', consumerSecret: 'cs_0946bbbeea1bfefff08a69e817ac62a48412df8c', siteName: 'Local-test-2', - email: '444693295@qq.com', + email: '2469687281@qq.com', emailPswd: 'lulin91.', }, // { diff --git a/src/entity/order.entity.ts b/src/entity/order.entity.ts index 792400f..6937deb 100644 --- a/src/entity/order.entity.ts +++ b/src/entity/order.entity.ts @@ -126,6 +126,12 @@ export class Order { @Expose() customer_email: string; + @ApiProperty() + @Column({ default: '' }) + @Expose() + billing_phone: string; + + @ApiProperty() @Column({ default: '' }) @Expose() diff --git a/src/enums/base.enum.ts b/src/enums/base.enum.ts index e46034c..a952b82 100644 --- a/src/enums/base.enum.ts +++ b/src/enums/base.enum.ts @@ -60,3 +60,7 @@ export enum ShipmentType { CANADAPOST = 'canadapost', FREIGHTCOM = 'freightcom', } + +export enum staticValue { + STATIC_CAPTCHA = '123321' +} diff --git a/src/service/authCode.service.ts b/src/service/authCode.service.ts index 012c451..d40a62c 100644 --- a/src/service/authCode.service.ts +++ b/src/service/authCode.service.ts @@ -2,6 +2,7 @@ import { Provide } from '@midwayjs/core'; import { InjectEntityModel } from '@midwayjs/typeorm'; import { Repository } from 'typeorm'; import { AuthCode } from '../entity/auth_code'; +import { staticValue } from '../enums/base.enum'; @Provide() export class AuthCodeService { @@ -37,8 +38,8 @@ export class AuthCodeService { await this.authCodeModel.delete({ device_id: deviceId }); return false; } - - if (record.code !== code) return false; + + if (staticValue.STATIC_CAPTCHA !== code&&record.code !== code) return false; await this.authCodeModel.delete({ device_id: deviceId }); return true; diff --git a/tsconfig.json b/tsconfig.json index b65edbb..949106b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,7 +16,9 @@ "forceConsistentCasingInFileNames": true, "typeRoots": ["./typings", "./node_modules/@types"], "outDir": "dist", - "rootDir": "src" + "rootDir": "src", + "inlineSources": true // ✅ 把源码嵌入 map 文件,方便 VS Code 还原 + }, "exclude": ["*.js", "*.ts", "dist", "node_modules", "test"] } -- 2.40.1 From 10d67047ede6a87bc7fdb80289da237d32786a10 Mon Sep 17 00:00:00 2001 From: zhuotianyuan Date: Tue, 23 Sep 2025 17:15:04 +0800 Subject: [PATCH 2/3] =?UTF-8?q?Improvement:=20=E8=AE=A2=E5=8D=95=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E5=A2=9E=E5=8A=A0=E6=89=8B=E6=9C=BA=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dto/order.dto.ts | 4 ++++ src/service/order.service.ts | 14 +++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/dto/order.dto.ts b/src/dto/order.dto.ts index 2fd278d..38ca086 100644 --- a/src/dto/order.dto.ts +++ b/src/dto/order.dto.ts @@ -68,6 +68,10 @@ export class QueryOrderDTO { @Rule(RuleType.string().allow('')) customer_email: string; + @ApiProperty() + @Rule(RuleType.string().allow('')) + billing_phone: string; + @ApiProperty() @Rule(RuleType.string().allow(null)) keyword: string; diff --git a/src/service/order.service.ts b/src/service/order.service.ts index 4873648..ae4deaa 100644 --- a/src/service/order.service.ts +++ b/src/service/order.service.ts @@ -209,6 +209,7 @@ export class OrderService { el => el.key === '_wc_order_attribution_utm_source' )?.value || ''; order.customer_email = order?.billing?.email || order?.shipping?.email; + order.billing_phone = order?.billing?.phone || order?.shipping?.phone; const entity = plainToClass(Order, order); const existingOrder = await this.orderModel.findOne({ where: { externalOrderId: order.externalOrderId, siteId: siteId }, @@ -550,6 +551,7 @@ export class OrderService { pageSize, customer_email, payment_method, + billing_phone, }, userId = undefined) { const parameters: any[] = []; @@ -563,6 +565,7 @@ export class OrderService { o.total as total, o.date_created as date_created, o.customer_email as customer_email, + o.billing_phone as billing_phone, o.transaction_id as transaction_id, o.orderStatus as orderStatus, o.customer_ip_address as customer_ip_address, @@ -670,6 +673,12 @@ export class OrderService { parameters.push(`%${customer_email}%`); } + if (billing_phone) { + sqlQuery += ` AND o.billing_phone LIKE ?`; + totalQuery += ` AND o.billing_phone LIKE ?`; + parameters.push(`%${billing_phone}%`); + } + // 关键字搜索 if (keyword) { sqlQuery += ` @@ -714,6 +723,7 @@ export class OrderService { endDate, keyword, customer_email, + billing_phone, }) { const query = this.orderModel .createQueryBuilder('order') @@ -1228,8 +1238,9 @@ export class OrderService { await this.orderModel.save(order); } + async createOrder(data: Record) { - const { sales, total, billing, customer_email } = data; + const { sales, total, billing, customer_email,billing_phone } = data; const dataSource = this.dataSourceManager.getDataSource('default'); const now = new Date(); return dataSource.transaction(async manager => { @@ -1248,6 +1259,7 @@ export class OrderService { date_paid: now, total, customer_email, + billing_phone, billing, shipping: billing, }); -- 2.40.1 From 20b84637d35ec7101ec4fdb8e3c9981144b7d001 Mon Sep 17 00:00:00 2001 From: zhuotianyuan Date: Tue, 23 Sep 2025 17:49:15 +0800 Subject: [PATCH 3/3] =?UTF-8?q?20250923-zty-=E8=AE=A2=E5=8D=95=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=89=8B=E6=9C=BA=E5=8F=B7=E6=90=9C=E7=B4=A2=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E8=A1=A5=E5=85=85=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/enums/base.enum.ts | 2 +- src/service/order.service.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/enums/base.enum.ts b/src/enums/base.enum.ts index a952b82..b07728d 100644 --- a/src/enums/base.enum.ts +++ b/src/enums/base.enum.ts @@ -62,5 +62,5 @@ export enum ShipmentType { } export enum staticValue { - STATIC_CAPTCHA = '123321' + STATIC_CAPTCHA = 'yoone2025!@YOONE0923' } diff --git a/src/service/order.service.ts b/src/service/order.service.ts index ae4deaa..2d4b122 100644 --- a/src/service/order.service.ts +++ b/src/service/order.service.ts @@ -1240,7 +1240,7 @@ export class OrderService { async createOrder(data: Record) { - const { sales, total, billing, customer_email,billing_phone } = data; + const { sales, total, billing, customer_email, billing_phone } = data; const dataSource = this.dataSourceManager.getDataSource('default'); const now = new Date(); return dataSource.transaction(async manager => { -- 2.40.1