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) => {