fix
This commit is contained in:
@@ -89,3 +89,10 @@ func (c *FsCartModel) Update(ctx context.Context, id int64, data FsCart) error {
|
||||
func (c *FsCartModel) UpdateByIdUserId(ctx context.Context, id int64, userId int64, data FsCart) error {
|
||||
return c.db.WithContext(ctx).Model(&FsCart{}).Where("`id` = ? and `user_id` = ?", id, userId).Updates(data).Error
|
||||
}
|
||||
func (c *FsCartModel) CountUserCart(ctx context.Context, userId int64) (total int64, err error) {
|
||||
err = c.db.WithContext(ctx).Model(&FsCart{}).Where("`user_id` = ? and `status` = ? limit 1", userId, 1).Count(&total).Error
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ func (s *FsProductSizeModel) GetAllByIds(ctx context.Context, ids []int64, sort
|
||||
return
|
||||
}
|
||||
func (s *FsProductSizeModel) CountByStatus(ctx context.Context, status int) (total int64, err error) {
|
||||
err = s.db.WithContext(ctx).Model(&FsProductSize{}).Where("`status` = ? ", status).Count(&total).Error
|
||||
err = s.db.WithContext(ctx).Model(&FsProductSize{}).Where("`status` = ? limit 1", status).Count(&total).Error
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user