diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index 355843947..3ce17bf77 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -307,12 +307,13 @@ type StoreSkuExt struct { JxLockTime *time.Time `orm:"null" json:"jxLockTime,omitempty"` YbLockTime *time.Time `orm:"null" json:"ybLockTime,omitempty"` - ActPrice int `json:"actPrice"` - ActID int `orm:"column(act_id)" json:"actID"` - ActType int `orm:"column(act_type)" json:"actType"` - DiscountType int `json:"discountType"` - DiscountValue1 int `json:"discountValue1"` - DiscountValue2 int `json:"discountValue2"` + VendorActMaps []*VendorActMap `json:"vendorActMaps"` + ActPrice int `json:"actPrice"` + ActID int `orm:"column(act_id)" json:"actID"` + ActType int `orm:"column(act_type)" json:"actType"` + DiscountType int `json:"discountType"` + DiscountValue1 int `json:"discountValue1"` + DiscountValue2 int `json:"discountValue2"` EarningPrice int `json:"earningPrice"` EarningActID int `orm:"column(earning_act_id)" json:"earningActID"` @@ -323,6 +324,13 @@ type StoreSkuExt struct { MtLadderBoxPrice int `json:"mtLadderBoxPrice"` } +type VendorActMap struct { + ActID string `json:"actID"` + ActType int `json:"actType"` + VendorID int `json:"vendorID"` + ActPrice int `json:"actPrice"` +} + type SkuNameAndPlace struct { model.SkuName UnitPrice int `json:"unitPrice"` @@ -1457,6 +1465,7 @@ func UpdateActPrice4StoreSkuNameNew(db *DaoDB, storeIDs, skuIDs []int, skuNamesI for _, skuName := range skuNamesInfo.SkuNames { if len(skuName.Skus) > 0 { for _, v := range skuName.Skus { + actVendorMap := make(map[int]*struct{}) if actStoreSku := actStoreSkuMap4Act.GetActStoreSku(skuName.StoreID, v.SkuID, -1); actStoreSku != nil { v.ActPrice = int(actStoreSku.ActualActPrice) v.ActID = actStoreSku.ActID @@ -1467,6 +1476,13 @@ func UpdateActPrice4StoreSkuNameNew(db *DaoDB, storeIDs, skuIDs []int, skuNamesI v.DiscountType = actStoreSku.DiscountType v.DiscountValue1 = actStoreSku.DiscountValue1 v.DiscountValue2 = actStoreSku.DiscountValue2 + v.VendorActMaps = append(v.VendorActMaps, &VendorActMap{ + ActID: utils.Int2Str(v.ActID), + ActType: v.ActType, + ActPrice: v.ActPrice, + VendorID: actStoreSku.VendorID, + }) + actVendorMap[actStoreSku.VendorID] = &struct{}{} } if actStoreSku := actStoreSkuMap4EarningPrice.GetActStoreSku(skuName.StoreID, v.SkuID, -1); actStoreSku != nil { v.EarningPrice = int(actStoreSku.EarningPrice) @@ -1490,6 +1506,15 @@ func UpdateActPrice4StoreSkuNameNew(db *DaoDB, storeIDs, skuIDs []int, skuNamesI } } + if actVendorMap[model.VendorIDMTWM] == nil { + v.VendorActMaps = append(v.VendorActMaps, &VendorActMap{ + ActID: mtactMap[skuName.StoreID][v.SkuID].ItemID, + ActType: mtactMap[skuName.StoreID][v.SkuID].ActType, + ActPrice: int(jxutils.StandardPrice2Int(mtactMap[skuName.StoreID][v.SkuID].ActPrice)), + VendorID: model.VendorIDMTWM, + }) + } + if (actVendorID == -1 || actVendorID == model.VendorIDEBAI) && v.ActPrice == 0 { if ebaiactMap != nil { ebaiact := ebaiactMap[skuName.StoreID][v.SkuID] @@ -1502,6 +1527,15 @@ func UpdateActPrice4StoreSkuNameNew(db *DaoDB, storeIDs, skuIDs []int, skuNamesI } } + if actVendorMap[model.VendorIDEBAI] == nil { + v.VendorActMaps = append(v.VendorActMaps, &VendorActMap{ + ActID: ebaiactMap[skuName.StoreID][v.SkuID].ActID, + ActType: model.ActSkuDirectDown, + ActPrice: int(jxutils.StandardPrice2Int(ebaiactMap[skuName.StoreID][v.SkuID].ActPrice)), + VendorID: model.VendorIDEBAI, + }) + } + if globals.IsStoreSkuAct { v.VendorInfoMap = make(map[int]*StoreSkuVendorInfo) for _, storeMap := range storeMapMap[skuName.StoreID] {