fix: 修复商品克重保存问题

- schema添加Weight字段
- Create和Update处理中添加Weight字段支持

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 21:51:34 +08:00
parent 321681e2ea
commit c1145113aa
2 changed files with 6 additions and 0 deletions
+4
View File
@@ -236,6 +236,7 @@ func (h *ProductHandler) Create(c *gin.Context) {
Name: req.Name,
Description: req.Description,
Price: req.Price,
Weight: req.Weight,
MinPurchase: req.MinPurchase,
MaxPurchase: req.MaxPurchase,
MinWeight: req.MinWeight,
@@ -299,6 +300,9 @@ func (h *ProductHandler) Update(c *gin.Context) {
if req.Price != nil {
updates["price"] = *req.Price
}
if req.Weight != nil {
updates["weight"] = *req.Weight
}
if req.MinPurchase != nil {
updates["min_purchase"] = *req.MinPurchase
}