- fk
This commit is contained in:
@@ -540,16 +540,10 @@ func QueryActs(ctx *jxcontext.Context, actID int, offset, pageSize int, keyword
|
|||||||
|
|
||||||
func GetActStoreSkuInfo(ctx *jxcontext.Context, actID int, vendorIDs []int) (actStoreSkuList []*model.ActStoreSku2, err error) {
|
func GetActStoreSkuInfo(ctx *jxcontext.Context, actID int, vendorIDs []int) (actStoreSkuList []*model.ActStoreSku2, err error) {
|
||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
actStoreSkuMap, err := dao.GetActStoreSkuVendorInfo(db, actID, vendorIDs, nil, nil)
|
actStoreSkuList, err = dao.GetActStoreSkuVendorList(db, actID, vendorIDs, nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// if len(actStoreSkuMap) == 0 {
|
|
||||||
// return nil, fmt.Errorf("不能找到活动:%d", actID)
|
|
||||||
// }
|
|
||||||
for _, v := range actStoreSkuMap {
|
|
||||||
actStoreSkuList = append(actStoreSkuList, v...)
|
|
||||||
}
|
|
||||||
return actStoreSkuList, err
|
return actStoreSkuList, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ func GetActVendorInfo(db *DaoDB, actID int, vendorIDs []int) (actMap map[int]*mo
|
|||||||
return actMap, err
|
return actMap, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActStoreSkuVendorInfo(db *DaoDB, actID int, vendorIDs, storeIDs, skuIDs []int) (actStoreSkuMap map[int][]*model.ActStoreSku2, err error) {
|
func GetActStoreSkuVendorList(db *DaoDB, actID int, vendorIDs, storeIDs, skuIDs []int) (actStoreSkuList []*model.ActStoreSku2, err error) {
|
||||||
globals.SugarLogger.Debugf("GetActStoreSkuVendorInfo actID:%d", actID)
|
globals.SugarLogger.Debugf("GetActStoreSkuVendorList actID:%d", actID)
|
||||||
leftOrEmpty := ""
|
leftOrEmpty := ""
|
||||||
if len(vendorIDs) == 1 && vendorIDs[0] == -1 {
|
if len(vendorIDs) == 1 && vendorIDs[0] == -1 {
|
||||||
leftOrEmpty = "LEFT"
|
leftOrEmpty = "LEFT"
|
||||||
@@ -125,11 +125,20 @@ func GetActStoreSkuVendorInfo(db *DaoDB, actID int, vendorIDs, storeIDs, skuIDs
|
|||||||
sql += " AND t1.sku_id IN (" + GenQuestionMarks(len(skuIDs)) + ")"
|
sql += " AND t1.sku_id IN (" + GenQuestionMarks(len(skuIDs)) + ")"
|
||||||
sqlParams = append(sqlParams, skuIDs)
|
sqlParams = append(sqlParams, skuIDs)
|
||||||
}
|
}
|
||||||
var actStoreSkuList []*model.ActStoreSku2
|
globals.SugarLogger.Debug(sql)
|
||||||
// globals.SugarLogger.Debug(sql)
|
globals.SugarLogger.Debug(utils.Format4Output(sqlParams, false))
|
||||||
// globals.SugarLogger.Debug(utils.Format4Output(sqlParams, false))
|
|
||||||
// globals.SugarLogger.Debug(utils.Format4Output(actStoreSkuList, false))
|
// globals.SugarLogger.Debug(utils.Format4Output(actStoreSkuList, false))
|
||||||
if err = GetRows(db, &actStoreSkuList, sql, sqlParams...); err == nil {
|
err = GetRows(db, &actStoreSkuList, sql, sqlParams...)
|
||||||
|
return actStoreSkuList, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetActStoreSkuVendorInfo(db *DaoDB, actID int, vendorIDs, storeIDs, skuIDs []int) (actStoreSkuMap map[int][]*model.ActStoreSku2, err error) {
|
||||||
|
leftOrEmpty := ""
|
||||||
|
if len(vendorIDs) == 1 && vendorIDs[0] == -1 {
|
||||||
|
leftOrEmpty = "LEFT"
|
||||||
|
}
|
||||||
|
actStoreSkuList, err := GetActStoreSkuVendorList(db, actID, vendorIDs, storeIDs, skuIDs)
|
||||||
|
if err == nil {
|
||||||
actStoreSkuMap = make(map[int][]*model.ActStoreSku2)
|
actStoreSkuMap = make(map[int][]*model.ActStoreSku2)
|
||||||
for _, v := range actStoreSkuList {
|
for _, v := range actStoreSkuList {
|
||||||
if leftOrEmpty != "" {
|
if leftOrEmpty != "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user