+ OrderSkuFinancial.StoreSubID, StoreSubName
This commit is contained in:
@@ -332,10 +332,12 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao.
|
|||||||
// }
|
// }
|
||||||
// } else
|
// } else
|
||||||
if actStoreSkuMap != nil {
|
if actStoreSkuMap != nil {
|
||||||
if skuID := jxutils.GetSkuIDFromOrderSku(v); skuID > 0 /*&& v.StoreSubName != ""*/ {
|
if skuID := jxutils.GetSkuIDFromOrderSku(v); skuID > 0 {
|
||||||
if actStoreSku := actStoreSkuMap.GetActStoreSku(jxStoreID, skuID, order.VendorID); actStoreSku != nil && v.StoreSubName != "" {
|
if actStoreSku := actStoreSkuMap.GetActStoreSku(jxStoreID, skuID, order.VendorID); actStoreSku != nil {
|
||||||
v.EarningPrice = actStoreSku.EarningPrice
|
v.EarningPrice = actStoreSku.EarningPrice
|
||||||
v.StoreSubID = actStoreSku.ActID
|
if v.StoreSubName != "" {
|
||||||
|
v.StoreSubID = actStoreSku.ActID
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -236,11 +236,16 @@ func (c *OrderManager) updateAfsOrderSkuOtherInfo(db *dao.DaoDB, order *model.Af
|
|||||||
}
|
}
|
||||||
orderSkus := order.Skus
|
orderSkus := order.Skus
|
||||||
vendorSkuIDs := make([]int64, 0)
|
vendorSkuIDs := make([]int64, 0)
|
||||||
|
skuIDMap := make(map[int]int)
|
||||||
for _, v := range orderSkus {
|
for _, v := range orderSkus {
|
||||||
intVendorSkuID := utils.Str2Int64WithDefault(v.VendorSkuID, 0)
|
intVendorSkuID := utils.Str2Int64WithDefault(v.VendorSkuID, 0)
|
||||||
if intVendorSkuID != 0 {
|
if intVendorSkuID != 0 {
|
||||||
vendorSkuIDs = append(vendorSkuIDs, intVendorSkuID)
|
vendorSkuIDs = append(vendorSkuIDs, intVendorSkuID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if skuID := jxutils.GetSkuIDFromOrderSkuFinancial(v); skuID > 0 {
|
||||||
|
skuIDMap[skuID] = 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if len(vendorSkuIDs) > 0 {
|
if len(vendorSkuIDs) > 0 {
|
||||||
tableName := "t2"
|
tableName := "t2"
|
||||||
@@ -263,6 +268,17 @@ func (c *OrderManager) updateAfsOrderSkuOtherInfo(db *dao.DaoDB, order *model.Af
|
|||||||
for _, v := range skuInfos {
|
for _, v := range skuInfos {
|
||||||
skumapper[v.VendorSkuID] = v
|
skumapper[v.VendorSkuID] = v
|
||||||
}
|
}
|
||||||
|
var actStoreSkuMap *jxutils.ActStoreSkuMap
|
||||||
|
if len(skuIDMap) > 0 {
|
||||||
|
if order2, err2 := c.LoadOrder(order.VendorOrderID, order.VendorID); err2 == nil {
|
||||||
|
actStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, []int{order.VendorID}, []int{jxStoreID}, jxutils.IntMap2List(skuIDMap), order2.OrderCreatedAt, order2.OrderCreatedAt)
|
||||||
|
if err != nil {
|
||||||
|
globals.SugarLogger.Errorf("updateAfsOrderSkuOtherInfo can not get sku promotion info for error:%v", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
actStoreSkuMap = jxutils.NewActStoreSkuMap(actStoreSkuList, false)
|
||||||
|
}
|
||||||
|
}
|
||||||
for _, v := range orderSkus {
|
for _, v := range orderSkus {
|
||||||
v.AfsOrderID = order.AfsOrderID
|
v.AfsOrderID = order.AfsOrderID
|
||||||
v.VendorID = order.VendorID
|
v.VendorID = order.VendorID
|
||||||
@@ -281,6 +297,13 @@ func (c *OrderManager) updateAfsOrderSkuOtherInfo(db *dao.DaoDB, order *model.Af
|
|||||||
v.JxSkuID = skuBindInfo.SkuID
|
v.JxSkuID = skuBindInfo.SkuID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if actStoreSkuMap != nil {
|
||||||
|
if skuID := jxutils.GetSkuIDFromOrderSkuFinancial(v); skuID > 0 && v.StoreSubName != "" {
|
||||||
|
if actStoreSku := actStoreSkuMap.GetActStoreSku(jxStoreID, skuID, order.VendorID); actStoreSku != nil {
|
||||||
|
v.StoreSubID = actStoreSku.ActID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -151,6 +151,8 @@ type OrderSkuFinancial struct {
|
|||||||
// CreatedAt time.Time `orm:"type(datetime);index" json:"createdAt"` // 订单创建时间
|
// CreatedAt time.Time `orm:"type(datetime);index" json:"createdAt"` // 订单创建时间
|
||||||
// JxSkuMoney int64 `json:"jxSkuMoney"` // 京西补贴金额,现阶段是平台扣京西多少钱,京西扣商家多少钱,暂不考虑撤回京西补贴
|
// JxSkuMoney int64 `json:"jxSkuMoney"` // 京西补贴金额,现阶段是平台扣京西多少钱,京西扣商家多少钱,暂不考虑撤回京西补贴
|
||||||
// SkuType int `json:"-"` // 当前如果为gift就为1,否则缺省为0
|
// SkuType int `json:"-"` // 当前如果为gift就为1,否则缺省为0
|
||||||
|
StoreSubID int `orm:"column(store_sub_id)" json:"storeSubID"` // 当前这个字段被当成活动ID用
|
||||||
|
StoreSubName string `orm:"size(64)" json:"storeSubName"` // 当前这个字段被用作vendorActType
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *OrderSkuFinancial) TableIndex() [][]string {
|
func (o *OrderSkuFinancial) TableIndex() [][]string {
|
||||||
|
|||||||
@@ -162,6 +162,9 @@ func (c *PurchaseHandler) buildAfsOrder(afsInfo *jdapi.AfsServiceResponse) (afsO
|
|||||||
UserMoney: x.AfsMoney,
|
UserMoney: x.AfsMoney,
|
||||||
PmSkuSubsidyMoney: x.PlatPayMoney,
|
PmSkuSubsidyMoney: x.PlatPayMoney,
|
||||||
}
|
}
|
||||||
|
if x.PromotionType != 0 && x.PromotionType != jdapi.PromotionTypeNormal {
|
||||||
|
orderSku.StoreSubName = utils.Int2Str(x.PromotionType)
|
||||||
|
}
|
||||||
afsOrder.PmSkuSubsidyMoney += orderSku.PmSkuSubsidyMoney
|
afsOrder.PmSkuSubsidyMoney += orderSku.PmSkuSubsidyMoney
|
||||||
orderSku.PmSubsidyMoney += orderSku.PmSkuSubsidyMoney
|
orderSku.PmSubsidyMoney += orderSku.PmSkuSubsidyMoney
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user