fix version 1
This commit is contained in:
@@ -24,7 +24,7 @@ func Create(ctx context.Context, in *pb.CartAddRequest) (reply *pb.OrderStatusRe
|
||||
}
|
||||
var cart *models.OrderCart
|
||||
|
||||
err = impl.DBService.Where("cart_identity=? and product_identity=? and spec_id = ? ", in.CartIdentity, in.ProductIdentity, in.SpecId).First(&cart).Error
|
||||
err = impl.DBService.Where("passport_identity=? and cart_identity=? and product_identity=? and spec_id = ? ", auth.Identity, in.CartIdentity, in.ProductIdentity, in.SpecId).First(&cart).Error
|
||||
if err != nil {
|
||||
if !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
printer.Error(err.Error())
|
||||
@@ -46,7 +46,7 @@ func Create(ctx context.Context, in *pb.CartAddRequest) (reply *pb.OrderStatusRe
|
||||
err = impl.DBService.Create(&data).Error
|
||||
} else {
|
||||
data.Number += cart.Number
|
||||
err = impl.DBService.Where("cart_identity=? and product_identity=? and spec_id = ? ", in.CartIdentity, in.ProductIdentity, in.SpecId).Updates(&data).Error
|
||||
err = impl.DBService.Where("passport_identity=? and cart_identity=? and product_identity=? and spec_id = ? ", auth.Identity, in.CartIdentity, in.ProductIdentity, in.SpecId).Updates(&data).Error
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user