GetEffectiveActStoreSkuInfo, ActTypeAll

This commit is contained in:
gazebo
2019-12-16 16:46:05 +08:00
parent 84f2c8930c
commit 7296b5cca3
7 changed files with 8 additions and 6 deletions

View File

@@ -394,7 +394,7 @@ func updateSingleOrderEarningPrice(order *model.GoodsOrder, db *dao.DaoDB) {
skuIDMap[v.SkuID] = 1 skuIDMap[v.SkuID] = 1
} }
if len(skuIDMap) > 0 { if len(skuIDMap) > 0 {
actStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, []int{order.VendorID}, 0, []int{jxStoreID}, jxutils.IntMap2List(skuIDMap), order.OrderCreatedAt, order.OrderCreatedAt) actStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, []int{order.VendorID}, model.ActTypeAll, []int{jxStoreID}, jxutils.IntMap2List(skuIDMap), order.OrderCreatedAt, order.OrderCreatedAt)
if err != nil { if err != nil {
globals.SugarLogger.Errorf("updateOrderSkuOtherInfo can not get sku promotion info for error:%v", err) globals.SugarLogger.Errorf("updateOrderSkuOtherInfo can not get sku promotion info for error:%v", err)
} }

View File

@@ -273,7 +273,7 @@ func (c *OrderManager) updateAfsOrderSkuOtherInfo(db *dao.DaoDB, order *model.Af
var actStoreSkuMap *jxutils.ActStoreSkuMap var actStoreSkuMap *jxutils.ActStoreSkuMap
if len(skuIDMap) > 0 { if len(skuIDMap) > 0 {
if order2, err2 := c.LoadOrder(order.VendorOrderID, order.VendorID); err2 == nil { if order2, err2 := c.LoadOrder(order.VendorOrderID, order.VendorID); err2 == nil {
actStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, []int{order.VendorID}, 0, []int{jxStoreID}, jxutils.IntMap2List(skuIDMap), order2.OrderCreatedAt, order2.OrderCreatedAt) actStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, []int{order.VendorID}, model.ActTypeAll, []int{jxStoreID}, jxutils.IntMap2List(skuIDMap), order2.OrderCreatedAt, order2.OrderCreatedAt)
if err != nil { if err != nil {
globals.SugarLogger.Errorf("updateAfsOrderSkuOtherInfo can not get sku promotion info for error:%v", err) globals.SugarLogger.Errorf("updateAfsOrderSkuOtherInfo can not get sku promotion info for error:%v", err)
return err return err

View File

@@ -396,7 +396,7 @@ func ScorePromotionSku(storeInfo *cms.StoreExt) {
db := dao.GetDB() db := dao.GetDB()
beginTime := time.Now() beginTime := time.Now()
endTime := time.Now() endTime := time.Now()
actStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, -1, nil, 0, []int{storeID}, nil, beginTime, endTime) actStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, -1, nil, model.ActTypeAll, []int{storeID}, nil, beginTime, endTime)
finalScore := 0 finalScore := 0
if err == nil && len(actStoreSkuList) > 0 { if err == nil && len(actStoreSkuList) > 0 {
actStoreSkuMap := make(map[int]int) actStoreSkuMap := make(map[int]int)

View File

@@ -7,6 +7,7 @@ import (
) )
const ( const (
ActTypeAll = -1
ActSkuFake = 0 // 假活动,只用于存储活动结算信息 ActSkuFake = 0 // 假活动,只用于存储活动结算信息
ActSkuDirectDown = 3 // 兼容之前的 ActSkuDirectDown = 3 // 兼容之前的
ActSkuSecKill = 4 // 兼容之前的 ActSkuSecKill = 4 // 兼容之前的

View File

@@ -409,7 +409,7 @@ func GetEffectiveActStoreSkuInfo(db *DaoDB, actID int, vendorIDs []int, actType
sql = " AND t1.act_type = ?" sql = " AND t1.act_type = ?"
sqlParams = append(sqlParams, actID) sqlParams = append(sqlParams, actID)
} }
if actType > 0 { if actType != model.ActTypeAll {
sql = " AND t1.type = ?" sql = " AND t1.type = ?"
sqlParams = append(sqlParams, actType) sqlParams = append(sqlParams, actType)
} }

View File

@@ -5,6 +5,7 @@ import (
"time" "time"
"git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/model"
) )
func TestGetEffectiveActStoreSkuInfo(t *testing.T) { func TestGetEffectiveActStoreSkuInfo(t *testing.T) {
@@ -27,7 +28,7 @@ func TestGetEffectiveActStoreSkuInfo(t *testing.T) {
ToTime: utils.Str2Time("2019-08-06 12:34:56"), ToTime: utils.Str2Time("2019-08-06 12:34:56"),
}, },
} { } {
result, err := GetEffectiveActStoreSkuInfo(GetDB(), v.ActID, v.VendorIDs, 0, v.StoreIDs, v.SkuIDs, v.FromTime, v.ToTime) result, err := GetEffectiveActStoreSkuInfo(GetDB(), v.ActID, v.VendorIDs, model.ActTypeAll, v.StoreIDs, v.SkuIDs, v.FromTime, v.ToTime)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

View File

@@ -1136,7 +1136,7 @@ func UpdateActPrice4StoreSkuNameNew(db *DaoDB, storeIDs, skuIDs []int, skuNamesI
if actVendorID >= 0 { if actVendorID >= 0 {
vendorIDs = []int{actVendorID} vendorIDs = []int{actVendorID}
} }
actStoreSkuList, err := GetEffectiveActStoreSkuInfo(db, 0, vendorIDs, 0, storeIDs, skuIDs, time.Now(), time.Now()) actStoreSkuList, err := GetEffectiveActStoreSkuInfo(db, 0, vendorIDs, model.ActTypeAll, storeIDs, skuIDs, time.Now(), time.Now())
if err != nil { if err != nil {
globals.SugarLogger.Errorf("updateActPrice4StoreSkuNameNew can not get sku promotion info for error:%v", err) globals.SugarLogger.Errorf("updateActPrice4StoreSkuNameNew can not get sku promotion info for error:%v", err)
return err return err