From dcf03b1418538ea1d49cd569120d2c79d3120665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E9=A3=9E=E6=B4=8B?= <15778543+xufeiyang6017@user.noreply.gitee.com> Date: Tue, 13 Jan 2026 10:21:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=94=B6=E8=97=8F=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=8F=AA=E6=98=BE=E7=A4=BA=E4=B8=80=E4=B8=AA=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server-example/server-mysql.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server-example/server-mysql.js b/server-example/server-mysql.js index 9ef1429..dea89df 100644 --- a/server-example/server-mysql.js +++ b/server-example/server-mysql.js @@ -3794,7 +3794,8 @@ app.post('/api/favorites/list', async (req, res) => { { model: Product, as: 'Product', // 与关联定义中的别名一致 - attributes: ['productId', 'productName', 'price', 'quantity', 'grossWeight', 'imageUrls', 'created_at', 'specification', 'yolk', 'sourceType', 'supplyStatus'] + attributes: ['productId', 'productName', 'price', 'quantity', 'grossWeight', 'imageUrls', 'created_at', 'specification', 'yolk', 'sourceType', 'supplyStatus'], + required: false // 使用LEFT JOIN,即使商品不存在也会返回收藏记录 } ], order: [['date', 'DESC']]