订单结算价测试

This commit is contained in:
苏尹岚
2020-05-14 09:22:59 +08:00
parent e56231a2d8
commit f6c7275d4f
5 changed files with 18 additions and 1 deletions

View File

@@ -387,7 +387,7 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao.
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)
if len(result) > 0 && err == nil {
if (len(result) > 0 && err == nil) || v.IsVendorAct == model.YES {
if v.VendorPrice == v.SalePrice {
var earningPrice = 0
if v.ShopPrice < v.SalePrice {

View File

@@ -1,6 +1,10 @@
package jxutils
import (
"fmt"
"git.rosy.net.cn/baseapi/utils"
"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)) ||
(!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
}
}
fmt.Println("test11111111111111111111111111111111", utils.Format4Output(actStoreSkuMap, false))
actMap.actStoreSkuMap = actStoreSkuMap
return actMap
}

View File

@@ -154,6 +154,7 @@ type OrderSku struct {
SkuType int `json:"skuType"` // 当前如果为gift就为1否则缺省为0
PromotionType int `json:"promotionType"` // todo 当前是用于记录京东的PromotionType(生成jxorder用),没有做转换
OrderCreatedAt time.Time `orm:"type(datetime);index" json:"-"` // 分区考虑
IsVendorAct int `json:"isVendorAct"`
}
// 同样商品在一个订单中可能重复出现(比如搞活动时,相同商品价格不一样,第一个有优惠)

View File

@@ -232,6 +232,7 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
}
ignoreSkuMap := make(map[int]int)
// detail := result["detail"].([]interface{})
multiSkuMap := make(map[int]int)
for _, product := range detail {
// product := product2.(map[string]interface{})
skuName := product["food_name"].(string)
@@ -264,6 +265,12 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
// sku.SkuType = 1
// }
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)

View File

@@ -101,6 +101,9 @@ func (p *PurchaseHandler) GetStoreSkusFullInfo(ctx *jxcontext.Context, parentTas
if len(storeSkuList) == 1 {
storeSku := storeSkuList[0]
result, err := api.YinBaoAPI.QueryProductByBarcode(storeSku.VendorSkuID)
if err != nil || result == nil {
return nil, err
}
resultp, err := api.YinBaoAPI.QueryProductImagesByBarcode(result.Barcode)
// resultp, err := getProductImages(vendorStoreID, storeSku.VendorSkuID)
if err != nil {