feat: 添加购买分组功能,替代跨分类购物选项
Build and Push Docker Image / build-and-push (push) Successful in 1m0s
Build and Push Docker Image / deploy (push) Successful in 7s
Docker Build / Build and Push Docker Image (push) Has been cancelled
Docker Build / Deploy to Server (push) Has been cancelled

This commit is contained in:
2026-07-05 21:51:32 +08:00
parent b26fea9621
commit 4e86a9a6ad
12 changed files with 336 additions and 67 deletions
+13 -13
View File
@@ -49,17 +49,17 @@ func (h *CategoryHandler) Create(c *gin.Context) {
}
category := models.Category{
Name: req.Name,
Description: req.Description,
ParentID: req.ParentID,
MinAmount: req.MinAmount,
MaxAmount: req.MaxAmount,
MinQuantity: req.MinQuantity,
MaxQuantity: req.MaxQuantity,
MinWeight: req.MinWeight,
MaxWeight: req.MaxWeight,
AllowCrossCategory: req.AllowCrossCategory != nil && *req.AllowCrossCategory,
SortOrder: req.SortOrder,
Name: req.Name,
Description: req.Description,
ParentID: req.ParentID,
PurchaseGroupID: req.PurchaseGroupID,
MinAmount: req.MinAmount,
MaxAmount: req.MaxAmount,
MinQuantity: req.MinQuantity,
MaxQuantity: req.MaxQuantity,
MinWeight: req.MinWeight,
MaxWeight: req.MaxWeight,
SortOrder: req.SortOrder,
}
if err := utils.DB.Create(&category).Error; err != nil {
@@ -123,8 +123,8 @@ func (h *CategoryHandler) Update(c *gin.Context) {
if req.SortOrder != nil {
updates["sort_order"] = *req.SortOrder
}
if req.AllowCrossCategory != nil {
updates["allow_cross_category"] = *req.AllowCrossCategory
if req.PurchaseGroupID != nil {
updates["purchase_group_id"] = *req.PurchaseGroupID
}
utils.DB.Model(&category).Updates(updates)