|
|
@ -675,6 +675,17 @@ User.init({ |
|
|
defaultValue: Sequelize.NOW, |
|
|
defaultValue: Sequelize.NOW, |
|
|
onUpdate: Sequelize.NOW |
|
|
onUpdate: Sequelize.NOW |
|
|
}, |
|
|
}, |
|
|
|
|
|
// 新增字段
|
|
|
|
|
|
sourceType: { |
|
|
|
|
|
type: DataTypes.STRING(50), |
|
|
|
|
|
allowNull: true, |
|
|
|
|
|
comment: '货源类型' |
|
|
|
|
|
}, |
|
|
|
|
|
supplyStatus: { |
|
|
|
|
|
type: DataTypes.STRING(50), |
|
|
|
|
|
allowNull: true, |
|
|
|
|
|
comment: '供应状态' |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
}, { |
|
|
}, { |
|
|
sequelize, |
|
|
sequelize, |
|
|
@ -1709,7 +1720,9 @@ app.post('/api/product/list', async (req, res) => { |
|
|
], |
|
|
], |
|
|
attributes: { |
|
|
attributes: { |
|
|
include: [ |
|
|
include: [ |
|
|
'region' // 【新增】确保返回地区字段
|
|
|
'region', // 【新增】确保返回地区字段
|
|
|
|
|
|
'sourceType', // 【新增】确保返回货源类型字段
|
|
|
|
|
|
'supplyStatus' // 【新增】确保返回供应状态字段
|
|
|
] |
|
|
] |
|
|
}, |
|
|
}, |
|
|
order: [['created_at', 'DESC']], |
|
|
order: [['created_at', 'DESC']], |
|
|
@ -3536,6 +3549,7 @@ app.post('/api/products/detail', async (req, res) => { |
|
|
|
|
|
|
|
|
// 查询商品详情 - 排除hidden状态商品,直接使用Product表中的reservedCount字段
|
|
|
// 查询商品详情 - 排除hidden状态商品,直接使用Product表中的reservedCount字段
|
|
|
const product = await Product.findOne({ |
|
|
const product = await Product.findOne({ |
|
|
|
|
|
attributes: ['productId', 'productName', 'price', 'quantity', 'grossWeight', 'imageUrls', 'created_at', 'specification', 'yolk', 'sourceType', 'supplyStatus'], |
|
|
where: { |
|
|
where: { |
|
|
productId, |
|
|
productId, |
|
|
status: { [Sequelize.Op.not]: 'hidden' } |
|
|
status: { [Sequelize.Op.not]: 'hidden' } |
|
|
|