fix
This commit is contained in:
@@ -91,7 +91,6 @@ func (l *CalculateCartPriceLogic) CalculateCartPrice(req *types.CalculateCartPri
|
||||
subTotalPrice := int64(0)
|
||||
//开启事物
|
||||
err = l.svcCtx.MysqlConn.Transaction(func(tx *gorm.DB) error {
|
||||
shoppingCartModel := gmodel.NewFsShoppingCartModel(tx)
|
||||
for _, cart := range carts {
|
||||
modelInfo, ok := mapModel[*cart.ModelId]
|
||||
if !ok {
|
||||
@@ -138,7 +137,7 @@ func (l *CalculateCartPriceLogic) CalculateCartPrice(req *types.CalculateCartPri
|
||||
subTotalPrice += totalPrice
|
||||
}
|
||||
//更新购物车购买数量
|
||||
if err = shoppingCartModel.Update(l.ctx, cart.Id, userinfo.UserId, updData); err != nil {
|
||||
if err = tx.WithContext(l.ctx).Model(&gmodel.FsShoppingCart{}).Where("id = ? and user_id = ?", cart.Id, userinfo.UserId).Updates(updData).Error; err != nil {
|
||||
logx.Error(err)
|
||||
return errors.New(fmt.Sprintf("failed to update cart`s purchase quantity:%d", cart.Id))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user