新京东账号
This commit is contained in:
@@ -43,16 +43,18 @@ func OnCallbackMsg(msg *jdshopapi.CallBackResult) (err error) {
|
|||||||
})
|
})
|
||||||
case jcqapi.TopicOrderOut:
|
case jcqapi.TopicOrderOut:
|
||||||
utils.CallFuncAsync(func() {
|
utils.CallFuncAsync(func() {
|
||||||
order := getRealOrderID(msg.OrderID)
|
orders := getAllRealOrderID(msg.OrderID)
|
||||||
if order != nil {
|
if len(orders) > 0 {
|
||||||
if order.ActualPayPrice == 0 {
|
for _, order := range orders {
|
||||||
if jxutils.StandardPrice2Int(utils.Str2Float64(msg.OrderPayment)) == 0 {
|
if order.ActualPayPrice == 0 {
|
||||||
order.ActualPayPrice = jxutils.StandardPrice2Int(utils.Str2Float64(msg.OrderTotalPrice) + utils.Str2Float64(msg.FreightPrice) - utils.Str2Float64(msg.SellerDiscount))
|
if jxutils.StandardPrice2Int(utils.Str2Float64(msg.OrderPayment)) == 0 {
|
||||||
} else {
|
order.ActualPayPrice = jxutils.StandardPrice2Int(utils.Str2Float64(msg.OrderTotalPrice) + utils.Str2Float64(msg.FreightPrice) - utils.Str2Float64(msg.SellerDiscount))
|
||||||
order.ActualPayPrice = jxutils.StandardPrice2Int(utils.Str2Float64(msg.OrderPayment))
|
} else {
|
||||||
|
order.ActualPayPrice = jxutils.StandardPrice2Int(utils.Str2Float64(msg.OrderPayment))
|
||||||
|
}
|
||||||
|
order.TotalShopMoney = utils.Float64TwoInt64(float64(order.ActualPayPrice) * jdshopapi.JdsPayPercentage)
|
||||||
|
partner.CurOrderManager.UpdateOrderFields(order, []string{"ActualPayPrice", "TotalShopMoney"})
|
||||||
}
|
}
|
||||||
order.TotalShopMoney = utils.Float64TwoInt64(float64(order.ActualPayPrice) * jdshopapi.JdsPayPercentage)
|
|
||||||
partner.CurOrderManager.UpdateOrderFields(order, []string{"ActualPayPrice", "TotalShopMoney"})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -255,3 +257,17 @@ func getRealOrderID(orderID string) (order *model.GoodsOrder) {
|
|||||||
dao.GetRow(db, &order, sql, sqlParams)
|
dao.GetRow(db, &order, sql, sqlParams)
|
||||||
return order
|
return order
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getAllRealOrderID(orderID string) (orders []*model.GoodsOrder) {
|
||||||
|
var (
|
||||||
|
db = dao.GetDB()
|
||||||
|
)
|
||||||
|
sql := `
|
||||||
|
SELECT * FROM goods_order WHERE vendor_order_id2 = ?
|
||||||
|
`
|
||||||
|
sqlParams := []interface{}{
|
||||||
|
orderID,
|
||||||
|
}
|
||||||
|
dao.GetRows(db, &orders, sql, sqlParams)
|
||||||
|
return orders
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user