|
|
|
@ -1353,7 +1353,7 @@ app.put('/api/supplies/:id/edit', async (req, res) => { |
|
|
|
try { |
|
|
|
const connection = await pool.getConnection(); |
|
|
|
const productId = req.params.id; |
|
|
|
const { productName, price, costprice, quantity, grossWeight, yolk, specification, supplyStatus, description, region, contactId, producting, imageUrls } = req.body; |
|
|
|
const { productName, price, costprice, quantity, grossWeight, yolk, specification, supplyStatus, description, region, contactId, producting, imageUrls, autoOfflineTime } = req.body; |
|
|
|
|
|
|
|
// 开始事务
|
|
|
|
await connection.beginTransaction(); |
|
|
|
@ -1463,7 +1463,7 @@ app.put('/api/supplies/:id/edit', async (req, res) => { |
|
|
|
SET productName = ?, price = ?, costprice = ?, quantity = ?, grossWeight = ?, |
|
|
|
yolk = ?, specification = ?, producting = ?, supplyStatus = ?, description = ?, region = ?, |
|
|
|
product_contact = ?, contact_phone = ?, imageUrls = ?, |
|
|
|
autoOfflineHours = ?, updated_at = ? |
|
|
|
autoOfflineTime = ?, autoOfflineHours = ?, updated_at = ? |
|
|
|
WHERE id = ? |
|
|
|
`;
|
|
|
|
|
|
|
|
@ -1471,6 +1471,7 @@ app.put('/api/supplies/:id/edit', async (req, res) => { |
|
|
|
productName, price.toString(), costprice || '', quantityValue, grossWeight, |
|
|
|
yolk, specification, producting, supplyStatus, description, region, |
|
|
|
productContact, contactPhone, JSON.stringify(uploadedImageUrls), |
|
|
|
autoOfflineTime || null, // 自动下架时间
|
|
|
|
req.body.autoOfflineHours || 24, // 默认24小时
|
|
|
|
new Date(), // 更新updated_at字段
|
|
|
|
productId |
|
|
|
|