From 6a63e404f1df16d0bc7679f9dce6152eeb31ac24 Mon Sep 17 00:00:00 2001 From: luishou Date: Fri, 11 Sep 2026 15:02:43 +0800 Subject: [PATCH] =?UTF-8?q?fix(customers):=20=E4=BF=9D=E5=AD=98=E9=98=B4?= =?UTF-8?q?=E5=8E=86=E7=94=9F=E6=97=A5=E6=97=B6=E9=81=BF=E5=85=8D=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=94=B6=E7=AA=84=E5=AF=BC=E8=87=B4=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 编辑旧商户时保留阴历类型,类型上写成 1 | 2,不再把字段收成只能是 1。 Co-authored-by: Cursor --- src/app/(dashboard)/customers/actions.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/(dashboard)/customers/actions.ts b/src/app/(dashboard)/customers/actions.ts index 59497eb..d8fd025 100644 --- a/src/app/(dashboard)/customers/actions.ts +++ b/src/app/(dashboard)/customers/actions.ts @@ -117,9 +117,12 @@ export async function updateCustomer( where: { id }, select: { birthdayType: true }, }); - const data = toData(r.data); + const parsed = toData(r.data); // 改版前的阴历生日不能在保存其它字段时改成阳历,否则明年提醒日会错 - if (existing?.birthdayType === 2) data.birthdayType = 2; + const data = { + ...parsed, + birthdayType: existing?.birthdayType === 2 ? 2 : parsed.birthdayType, + }; await prisma.customer.update({ where: { id }, data }); revalidatePath("/customers");