GetEffectiveActStoreSkuInfo添加actType参数

修复ActStoreSkuParam2Model中调用GetEffectiveActStoreSkuInfo的bug
This commit is contained in:
gazebo
2019-12-16 16:39:39 +08:00
parent 21bb51ebb0
commit 84f2c8930c
8 changed files with 13 additions and 8 deletions

View File

@@ -369,7 +369,7 @@ func GetExistVendorActIDs(db *DaoDB, vendorID int) (vendorActIDs []string, err e
return vendorActIDs, err
}
func GetEffectiveActStoreSkuInfo(db *DaoDB, actID int, vendorIDs []int, storeIDs, skuIDs []int, beginAt, endAt time.Time) (actStoreSkuList []*model.ActStoreSku2, err error) {
func GetEffectiveActStoreSkuInfo(db *DaoDB, actID int, vendorIDs []int, actType int, storeIDs, skuIDs []int, beginAt, endAt time.Time) (actStoreSkuList []*model.ActStoreSku2, err error) {
if utils.IsTimeZero(beginAt) {
return nil, fmt.Errorf("GeActStoreSkuInfo必须指定活动开始时间")
}
@@ -406,9 +406,13 @@ func GetEffectiveActStoreSkuInfo(db *DaoDB, actID int, vendorIDs []int, storeIDs
sqlParams = append(sqlParams, model.GetVendorMask(vendorIDs...), vendorIDs)
}
if actID > 0 {
sql = " AND t1.id = ?"
sql = " AND t1.act_type = ?"
sqlParams = append(sqlParams, actID)
}
if actType > 0 {
sql = " AND t1.type = ?"
sqlParams = append(sqlParams, actType)
}
if len(storeIDs) > 0 {
sql += " AND t2.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
sqlParams = append(sqlParams, storeIDs)

View File

@@ -27,7 +27,7 @@ func TestGetEffectiveActStoreSkuInfo(t *testing.T) {
ToTime: utils.Str2Time("2019-08-06 12:34:56"),
},
} {
result, err := GetEffectiveActStoreSkuInfo(GetDB(), v.ActID, v.VendorIDs, v.StoreIDs, v.SkuIDs, v.FromTime, v.ToTime)
result, err := GetEffectiveActStoreSkuInfo(GetDB(), v.ActID, v.VendorIDs, 0, v.StoreIDs, v.SkuIDs, v.FromTime, v.ToTime)
if err != nil {
t.Fatal(err)
}

View File

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