This commit is contained in:
laodaming
2023-09-15 10:39:08 +08:00
parent 6e89f318fd
commit dd13dcbf0d
14 changed files with 25 additions and 15 deletions

View File

@@ -27,6 +27,11 @@ func (s *FsShoppingCartModel) Create(ctx context.Context, data *FsShoppingCart)
return s.db.WithContext(ctx).Create(&data).Error
}
// 删除
func (s *FsShoppingCartModel) Delete(ctx context.Context, id, userId int64) error {
return s.db.WithContext(ctx).Where("user_id = ? and id = ?", userId, id).Delete(&FsShoppingCart{}).Error
}
// 更新
func (s *FsShoppingCartModel) Update(ctx context.Context, id, userId int64, data *FsShoppingCart) error {
return s.db.WithContext(ctx).Where("user_id = ? and id = ?", userId, id).Updates(&data).Error