Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into develop
This commit is contained in:
@@ -107,7 +107,7 @@ var (
|
||||
CodeErrOrderCreatProductPriceAbsent = &StatusResponse{5304, "create order failed, price of product is absent"} // 订单创建失败,商品价格不存在
|
||||
CodeErrOrderCreatProductAccessoryAbsent = &StatusResponse{5305, "create order failed, accessory of product is absent"} // 订单创建失败,商品配件不存在
|
||||
CodeErrOrderCreatePrePaymentParam = &StatusResponse{5306, "create payment failed, the shipping address is illegal"} // 订单创建失败,商品配件不存在
|
||||
CodeErrOrderCreatePrePaymentInfoNoFound = &StatusResponse{5307, "create payment failed, order info not found"}
|
||||
CodeErrOrderCreatePrePaymentInfoNoFound = &StatusResponse{5307, "order info not found"}
|
||||
CodeErrOrderCreatePrePaymentNoUnPaid = &StatusResponse{5308, "create payment failed, order is not unpaid"}
|
||||
CodeErrOrderCreatePrePaymentPaid = &StatusResponse{5309, "create payment failed, order is paid"}
|
||||
CodeErrOrderCreatePrePaymentTimeout = &StatusResponse{5310, "create payment failed, timeout"}
|
||||
|
||||
@@ -166,6 +166,9 @@ func UpdateOrderStatusLink(statusLink []gmodel.OrderStatus, status gmodel.OrderS
|
||||
if status.Utime != nil {
|
||||
item.Utime = status.Utime
|
||||
}
|
||||
if status.Ctime != nil {
|
||||
item.Ctime = status.Ctime
|
||||
}
|
||||
if status.Metadata != nil {
|
||||
item.Metadata = status.Metadata
|
||||
}
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
package step_price
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fusenapi/model/gmodel"
|
||||
)
|
||||
|
||||
// 旧的返回厘(即将废弃)
|
||||
func GetCentStepPrice(minBuyNum int, stepNum []int, stepPrice []int) int64 {
|
||||
if minBuyNum > stepNum[len(stepNum)-1] {
|
||||
@@ -20,47 +15,3 @@ func GetCentStepPrice(minBuyNum int, stepNum []int, stepPrice []int) int64 {
|
||||
}
|
||||
return int64(stepPrice[len(stepPrice)-1])
|
||||
}
|
||||
|
||||
// 新的阶梯价格(返回美元)
|
||||
func GetNewStepPrice(purchaseQuantity int64, stepPrice gmodel.StepPriceJsonStruct, fittingPrice int64) (totalPrice, itemPrice float64, err error) {
|
||||
l := len(stepPrice.PriceRange)
|
||||
if l == 0 {
|
||||
return 0, 0, errors.New("price range is not set")
|
||||
}
|
||||
//遍历查询合适的价格
|
||||
for k, v := range stepPrice.PriceRange {
|
||||
//购买数量>起点
|
||||
if purchaseQuantity > v.StartQuantity {
|
||||
//最后一个 || 小于等于终点
|
||||
if k == l-1 || purchaseQuantity <= v.EndQuantity {
|
||||
itemPrice = float64(v.Price+fittingPrice) / 1000
|
||||
return itemPrice * float64(purchaseQuantity), itemPrice / 1000, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
//遍历里面没有则返回第一个
|
||||
itemPrice = float64(stepPrice.PriceRange[0].Price+fittingPrice) / 1000
|
||||
return itemPrice * float64(purchaseQuantity), itemPrice, nil
|
||||
}
|
||||
|
||||
// 新的阶梯价格(返回厘)
|
||||
func GetNewCentStepPrice(purchaseQuantity int64, stepPrice gmodel.StepPriceJsonStruct, fittingPrice int64) (totalPrice, itemPrice int64, err error) {
|
||||
l := len(stepPrice.PriceRange)
|
||||
if l == 0 {
|
||||
return 0, 0, errors.New("price range is not set")
|
||||
}
|
||||
//遍历查询合适的价格
|
||||
for k, v := range stepPrice.PriceRange {
|
||||
//购买数量>起点
|
||||
if purchaseQuantity > v.StartQuantity {
|
||||
//最后一个 || 小于等于终点
|
||||
if k == l-1 || purchaseQuantity <= v.EndQuantity {
|
||||
itemPrice = v.Price + fittingPrice
|
||||
return itemPrice * purchaseQuantity, itemPrice, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
//遍历里面没有则返回第一个
|
||||
itemPrice = stepPrice.PriceRange[0].Price + fittingPrice
|
||||
return itemPrice * purchaseQuantity, itemPrice, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user