fix
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"fusenapi/model/gmodel"
|
||||
"fusenapi/utils/auth"
|
||||
"fusenapi/utils/basic"
|
||||
@@ -72,7 +73,7 @@ func (l *CartAddLogic) CartAdd(req *types.CartAddReq, userinfo *auth.UserInfo) (
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, " product price info err: each box num can`t be zero")
|
||||
}
|
||||
//买的数量和每箱数量取余为0 且 份数大于等于最小购买数量才算满足条件
|
||||
if (int64(req.BuyNum) % *productPriceInfo.EachBoxNum) != 0 {
|
||||
if req.BuyNum%*productPriceInfo.EachBoxNum != 0 {
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "invalid buy number,please check")
|
||||
}
|
||||
if int64(float64(req.BuyNum)/float64(*productPriceInfo.EachBoxNum)) < *productPriceInfo.MinBuyNum {
|
||||
@@ -116,11 +117,12 @@ func (l *CartAddLogic) CartAdd(req *types.CartAddReq, userinfo *auth.UserInfo) (
|
||||
if cartInfo.Id == 0 {
|
||||
err = cartModel.Create(l.ctx, data)
|
||||
} else {
|
||||
fmt.Println("2222")
|
||||
err = cartModel.Update(l.ctx, cartInfo.Id, data)
|
||||
}
|
||||
if err != nil {
|
||||
/*if err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to add to cart")
|
||||
}
|
||||
}*/
|
||||
return resp.SetStatus(basic.CodeOK)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user