From 09e47bba31f372b256f4782f1a4bfedadf631519 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: Fri, 19 Dec 2025 10:42:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=B6=E9=97=B4=E5=A4=84?= =?UTF-8?q?=E7=90=86=E9=94=99=E8=AF=AF=EF=BC=9A1)=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E4=B8=8D=E5=AD=98=E5=9C=A8=E7=9A=84data()=E5=87=BD=E6=95=B0?= =?UTF-8?q?=EF=BC=9B2)=20=E7=A7=BB=E9=99=A4=E9=87=8D=E5=A4=8D=E7=9A=848?= =?UTF-8?q?=E5=B0=8F=E6=97=B6=E6=97=B6=E5=8C=BA=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server-example/server-mysql.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/server-example/server-mysql.js b/server-example/server-mysql.js index 83f1e30..af43d9e 100644 --- a/server-example/server-mysql.js +++ b/server-example/server-mysql.js @@ -1,17 +1,22 @@ -// 时间处理辅助函数 - 获取UTC+8时间 -function getBeijingTime() { - const now = new Date(); - return new Date(now.getTime() + 8 * 60 * 60 * 1000); // 手动加8小时 +// 时间处理辅助函数 - 获取当前时间 +// 由于Sequelize已设置时区为+08:00,不需要手动加8小时 +function getCurrentTime() { + return new Date(); } -function getBeijingTimeISOString() { - return getBeijingTime().toISOString(); +function getCurrentTimeISOString() { + return getCurrentTime().toISOString(); } -function getBeijingTimeTimestamp() { - return getBeijingTime().getTime(); +function getCurrentTimeTimestamp() { + return getCurrentTime().getTime(); } +// 为保持向后兼容,保留原函数名 +const getBeijingTime = getCurrentTime; +const getBeijingTimeISOString = getCurrentTimeISOString; +const getBeijingTimeTimestamp = getCurrentTimeTimestamp; + // 类型处理辅助函数 - 添加于修复聊天功能 function ensureStringId(id) { return String(id).trim(); @@ -6203,6 +6208,7 @@ function getStatusMessage(status) { // 导入并执行商品联系人更新函数 const updateProductContacts = require('./update-product-contacts'); +const { time } = require('console'); // 添加API接口:更新商品联系人信息 app.post('/api/products/update-contacts', async (req, res) => {