实验StoreSkuAct
This commit is contained in:
@@ -3,10 +3,12 @@ package putils
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
@@ -219,6 +221,14 @@ func StoreSkuList2MapBySkuID(storeSkuList []*partner.StoreSkuInfo) (storeSkuMap
|
||||
return storeSkuMap
|
||||
}
|
||||
|
||||
func StoreSkuList2IDs(storeSkuList []*partner.StoreSkuInfo) (ids []int) {
|
||||
ids = make([]int, len(storeSkuList))
|
||||
for k, v := range storeSkuList {
|
||||
ids[k] = v.SkuID
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
func UnselectStoreSkuListByVendorSkuIDs(storeSkuList []*partner.StoreSkuInfo, vendorSkuIDs []string) (selectedStoreSkuList []*partner.StoreSkuInfo) {
|
||||
if len(vendorSkuIDs) > 0 {
|
||||
vendorSkuIDMap := jxutils.StringList2Map(vendorSkuIDs)
|
||||
@@ -312,3 +322,34 @@ func GenPartialFailedErr(failedInfo interface{}, failedCount int) (err error) {
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func StoreSku2ActStoreSku(storeSkuList []*partner.StoreSkuInfo) (actStoreSku []*model.ActStoreSku2) {
|
||||
for _, v := range storeSkuList {
|
||||
actStoreSku = append(actStoreSku, &model.ActStoreSku2{
|
||||
ActStoreSku: model.ActStoreSku{
|
||||
SkuID: v.SkuID,
|
||||
Stock: 200,
|
||||
},
|
||||
VendorSkuID: v.VendorSkuID,
|
||||
ActualActPrice: v.ActPrice,
|
||||
})
|
||||
}
|
||||
return actStoreSku
|
||||
}
|
||||
|
||||
func GetFixDirectDownAct(storeID, skuID int) (act *model.Act2) {
|
||||
name := fmt.Sprintf("自动直降活动%d:%d:%d", storeID, skuID, time.Now().Unix())
|
||||
act = &model.Act2{
|
||||
Act: model.Act{
|
||||
Name: name,
|
||||
Advertising: name,
|
||||
Type: model.ActSkuDirectDown,
|
||||
Status: model.ActStatusCreated,
|
||||
LimitUser: 1,
|
||||
LimitCount: 1,
|
||||
BeginAt: utils.Time2Date(time.Now()),
|
||||
EndAt: utils.Time2Date(time.Now().Add(365 * 24 * time.Hour)),
|
||||
},
|
||||
}
|
||||
return act
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user