订单结算价测试
This commit is contained in:
@@ -387,7 +387,7 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao.
|
|||||||
storeID = order.StoreID
|
storeID = order.StoreID
|
||||||
}
|
}
|
||||||
result, err := dao.GetEffectiveActStoreSkuInfo2(db, 0, []int{order.VendorID}, []int{model.ActSkuSecKill, model.ActSkuDirectDown}, []int{storeID}, []int{v.SkuID}, order.OrderCreatedAt, order.OrderCreatedAt)
|
result, err := dao.GetEffectiveActStoreSkuInfo2(db, 0, []int{order.VendorID}, []int{model.ActSkuSecKill, model.ActSkuDirectDown}, []int{storeID}, []int{v.SkuID}, order.OrderCreatedAt, order.OrderCreatedAt)
|
||||||
if len(result) > 0 && err == nil {
|
if (len(result) > 0 && err == nil) || v.IsVendorAct == model.YES {
|
||||||
if v.VendorPrice == v.SalePrice {
|
if v.VendorPrice == v.SalePrice {
|
||||||
var earningPrice = 0
|
var earningPrice = 0
|
||||||
if v.ShopPrice < v.SalePrice {
|
if v.ShopPrice < v.SalePrice {
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
package jxutils
|
package jxutils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
|
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -19,9 +23,11 @@ func NewActStoreSkuMap(actStoreSkuList []*model.ActStoreSku2, isActPrice bool) (
|
|||||||
}
|
}
|
||||||
if (isActPrice && v.ActualActPrice > 0 && (actStoreSkuMap[index][v.VendorID] == nil || actStoreSkuMap[index][v.VendorID].ActualActPrice > v.ActualActPrice)) ||
|
if (isActPrice && v.ActualActPrice > 0 && (actStoreSkuMap[index][v.VendorID] == nil || actStoreSkuMap[index][v.VendorID].ActualActPrice > v.ActualActPrice)) ||
|
||||||
(!isActPrice && v.EarningPrice > 0 && (actStoreSkuMap[index][v.VendorID] == nil || actStoreSkuMap[index][v.VendorID].EarningPrice > v.EarningPrice)) {
|
(!isActPrice && v.EarningPrice > 0 && (actStoreSkuMap[index][v.VendorID] == nil || actStoreSkuMap[index][v.VendorID].EarningPrice > v.EarningPrice)) {
|
||||||
|
fmt.Println("test222222222222222222222222222222222", *v)
|
||||||
actStoreSkuMap[index][v.VendorID] = v
|
actStoreSkuMap[index][v.VendorID] = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fmt.Println("test11111111111111111111111111111111", utils.Format4Output(actStoreSkuMap, false))
|
||||||
actMap.actStoreSkuMap = actStoreSkuMap
|
actMap.actStoreSkuMap = actStoreSkuMap
|
||||||
return actMap
|
return actMap
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ type OrderSku struct {
|
|||||||
SkuType int `json:"skuType"` // 当前如果为gift就为1,否则缺省为0
|
SkuType int `json:"skuType"` // 当前如果为gift就为1,否则缺省为0
|
||||||
PromotionType int `json:"promotionType"` // todo 当前是用于记录京东的PromotionType(生成jxorder用),没有做转换
|
PromotionType int `json:"promotionType"` // todo 当前是用于记录京东的PromotionType(生成jxorder用),没有做转换
|
||||||
OrderCreatedAt time.Time `orm:"type(datetime);index" json:"-"` // 分区考虑
|
OrderCreatedAt time.Time `orm:"type(datetime);index" json:"-"` // 分区考虑
|
||||||
|
IsVendorAct int `json:"isVendorAct"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 同样商品在一个订单中可能重复出现(比如搞活动时,相同商品价格不一样,第一个有优惠)
|
// 同样商品在一个订单中可能重复出现(比如搞活动时,相同商品价格不一样,第一个有优惠)
|
||||||
|
|||||||
@@ -232,6 +232,7 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
|||||||
}
|
}
|
||||||
ignoreSkuMap := make(map[int]int)
|
ignoreSkuMap := make(map[int]int)
|
||||||
// detail := result["detail"].([]interface{})
|
// detail := result["detail"].([]interface{})
|
||||||
|
multiSkuMap := make(map[int]int)
|
||||||
for _, product := range detail {
|
for _, product := range detail {
|
||||||
// product := product2.(map[string]interface{})
|
// product := product2.(map[string]interface{})
|
||||||
skuName := product["food_name"].(string)
|
skuName := product["food_name"].(string)
|
||||||
@@ -264,6 +265,12 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
|||||||
// sku.SkuType = 1
|
// sku.SkuType = 1
|
||||||
// }
|
// }
|
||||||
order.Skus = append(order.Skus, sku)
|
order.Skus = append(order.Skus, sku)
|
||||||
|
multiSkuMap[sku.SkuID]++
|
||||||
|
}
|
||||||
|
for _, v := range order.Skus {
|
||||||
|
if multiSkuMap[v.SkuID] > 1 && v.SalePrice == v.VendorPrice {
|
||||||
|
v.IsVendorAct = model.YES
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jxutils.RefreshOrderSkuRelated(order)
|
jxutils.RefreshOrderSkuRelated(order)
|
||||||
|
|||||||
@@ -101,6 +101,9 @@ func (p *PurchaseHandler) GetStoreSkusFullInfo(ctx *jxcontext.Context, parentTas
|
|||||||
if len(storeSkuList) == 1 {
|
if len(storeSkuList) == 1 {
|
||||||
storeSku := storeSkuList[0]
|
storeSku := storeSkuList[0]
|
||||||
result, err := api.YinBaoAPI.QueryProductByBarcode(storeSku.VendorSkuID)
|
result, err := api.YinBaoAPI.QueryProductByBarcode(storeSku.VendorSkuID)
|
||||||
|
if err != nil || result == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
resultp, err := api.YinBaoAPI.QueryProductImagesByBarcode(result.Barcode)
|
resultp, err := api.YinBaoAPI.QueryProductImagesByBarcode(result.Barcode)
|
||||||
// resultp, err := getProductImages(vendorStoreID, storeSku.VendorSkuID)
|
// resultp, err := getProductImages(vendorStoreID, storeSku.VendorSkuID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user