Browse Source

修复时间处理错误:1) 修正不存在的data()函数;2) 移除重复的8小时时区转换

pull/1/head
徐飞洋 3 months ago
parent
commit
09e47bba31
  1. 22
      server-example/server-mysql.js

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

Loading…
Cancel
Save