1
This commit is contained in:
@@ -127,92 +127,91 @@ func TestSgin(t *testing.T) {
|
||||
fmt.Println(timestamp)
|
||||
}
|
||||
|
||||
//
|
||||
//func TestBaokuanHuodong(t *testing.T) {
|
||||
// // 获取门店所有的爆款活动
|
||||
// storeId := 668887
|
||||
// vendorStoreId := "17056471"
|
||||
//
|
||||
// actList, _ := api.RetailDiscountList(vendorStoreId, 56)
|
||||
// if len(actList) > 0 {
|
||||
// allActivitySkuIdList := make([]string, 0, 0) // 此门店全部的折扣(爆款)活动商品
|
||||
// activationActivitySkuIdList := make([]*StoreSkuInfo, 0, 0) // 此门店正在进行的折扣(爆款)活动商品
|
||||
// loseActivitySkuIdList := make([]*StoreSkuInfo, 0, 0) // 此门店已经结束的折扣(爆款)活动商品
|
||||
// for _, ac := range actList {
|
||||
// allActivitySkuIdList = append(allActivitySkuIdList, utils.Int64ToStr(ac.ItemID))
|
||||
// // 已经生效的爆款活动
|
||||
// if ac.Status == 1 && ac.SkuId != "" {
|
||||
// activity := &StoreSkuInfo{
|
||||
// SkuID: utils.Str2Int(ac.SkuId),
|
||||
// IsSpecialty: 1,
|
||||
// }
|
||||
// activationActivitySkuIdList = append(activationActivitySkuIdList, activity)
|
||||
// }
|
||||
// // 已经失效的爆款活动
|
||||
// if ac.Status == 0 && ac.SkuId != "" {
|
||||
// lose := &StoreSkuInfo{
|
||||
// SkuID: utils.Str2Int(ac.SkuId),
|
||||
// IsSpecialty: 0,
|
||||
// }
|
||||
// loseActivitySkuIdList = append(loseActivitySkuIdList, lose)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if err := UpdateStoreSkusSpecTag(nil, "589", storeId, vendorStoreId, loseActivitySkuIdList); err != nil {
|
||||
// globals.SugarLogger.Debugf("取消力荐错误:= %v", err)
|
||||
// }
|
||||
// // 重新推荐力荐商品
|
||||
// if err := UpdateStoreSkusSpecTag(nil, "589", storeId, vendorStoreId, activationActivitySkuIdList); err != nil {
|
||||
// globals.SugarLogger.Debugf("重推力荐错误:= %v", err)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
//
|
||||
//func UpdateStoreSkusSpecTag(aa interface{}, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*StoreSkuInfo) (err error) {
|
||||
// var foodDataList = []map[string]interface{}{}
|
||||
// for _, v := range storeSkuList {
|
||||
// var foodData = make(map[string]interface{})
|
||||
// if v.IsSpecialty == -1 {
|
||||
// v.IsSpecialty = 0
|
||||
// }
|
||||
// foodData["is_specialty"] = v.IsSpecialty
|
||||
// foodData["app_food_code"] = v.SkuID
|
||||
// foodDataList = append(foodDataList, foodData)
|
||||
// }
|
||||
// if len(foodDataList) == 1 {
|
||||
// err = api.RetailInitData("1111", vendorStoreID, utils.Int2Str(storeSkuList[0].SkuID), foodDataList[0])
|
||||
// } else if len(foodDataList) > 0 {
|
||||
// _, err = api.RetailBatchInitData("22222", vendorStoreID, foodDataList)
|
||||
// }
|
||||
// return err
|
||||
//}
|
||||
//
|
||||
//type StoreSkuInfo struct {
|
||||
// SkuID int `json:"skuID,omitempty"`
|
||||
// VendorSkuID string `json:"vendorSkuID,omitempty"`
|
||||
// NameID int `json:"nameID,omitempty"`
|
||||
// VendorNameID string `json:"vendorNameID,omitempty"`
|
||||
//
|
||||
// Stock int `json:"stock,omitempty"`
|
||||
// VendorPrice int64 `json:"price,omitempty"`
|
||||
// Status int `json:"status,omitempty"`
|
||||
//
|
||||
// Seq int `json:"seq,omitempty"`
|
||||
//
|
||||
// ActPrice int64 `json:"actPrice,omitempty"`
|
||||
// VendorActID string `json:"vendorActID,omitempty"`
|
||||
// IsSpecialty int `json:"isSpecialty,omitempty"`
|
||||
// JxPrice int64 `json:"jxPrice,omitempty"`
|
||||
// JxUnitPrice int64 `json:"jxUnitPrice,omitempty"`
|
||||
// VendorSkuID2 string `json:"vendorSkuID2,omitempty"`
|
||||
// JdsStockSwitch int `json:"jdsStockSwitch"`
|
||||
// IsDeletedBySku bool `json:"isDeletedBySku"`
|
||||
// VendorOrgCode string `json:"vendorOrgCode"`
|
||||
// SpecUnit string `json:"specUnit"`
|
||||
// SpecQuality float32 `json:"specQuality"`
|
||||
//
|
||||
// VendorMainId string `json:"vendorMainId"` // 主商品id
|
||||
// VendorSkuAttrId string `json:"vendorSkuAttrId"` //主商品sku_id
|
||||
// VendorSonSkuID string `json:"vendorSonSkuID"` // 子商品skuid
|
||||
//}
|
||||
func TestBaokuanHuodong(t *testing.T) {
|
||||
// 获取门店所有的爆款活动
|
||||
storeId := 668887
|
||||
vendorStoreId := "17056471"
|
||||
|
||||
actList, _ := api.RetailDiscountList(vendorStoreId, 56)
|
||||
if len(actList) > 0 {
|
||||
allActivitySkuIdList := make([]string, 0, 0) // 此门店全部的折扣(爆款)活动商品
|
||||
activationActivitySkuIdList := make([]*StoreSkuInfo, 0, 0) // 此门店正在进行的折扣(爆款)活动商品
|
||||
loseActivitySkuIdList := make([]*StoreSkuInfo, 0, 0) // 此门店已经结束的折扣(爆款)活动商品
|
||||
for _, ac := range actList {
|
||||
allActivitySkuIdList = append(allActivitySkuIdList, utils.Int64ToStr(ac.ItemID))
|
||||
// 已经生效的爆款活动
|
||||
if ac.Status == 1 && ac.SkuId != "" {
|
||||
activity := &StoreSkuInfo{
|
||||
SkuID: utils.Str2Int(ac.SkuId),
|
||||
IsSpecialty: 1,
|
||||
}
|
||||
activationActivitySkuIdList = append(activationActivitySkuIdList, activity)
|
||||
}
|
||||
// 已经失效的爆款活动
|
||||
if ac.Status == 0 && ac.SkuId != "" {
|
||||
lose := &StoreSkuInfo{
|
||||
SkuID: utils.Str2Int(ac.SkuId),
|
||||
IsSpecialty: 0,
|
||||
}
|
||||
loseActivitySkuIdList = append(loseActivitySkuIdList, lose)
|
||||
}
|
||||
}
|
||||
|
||||
if err := UpdateStoreSkusSpecTag(nil, "589", storeId, vendorStoreId, loseActivitySkuIdList); err != nil {
|
||||
globals.SugarLogger.Debugf("取消力荐错误:= %v", err)
|
||||
}
|
||||
// 重新推荐力荐商品
|
||||
if err := UpdateStoreSkusSpecTag(nil, "589", storeId, vendorStoreId, activationActivitySkuIdList); err != nil {
|
||||
globals.SugarLogger.Debugf("重推力荐错误:= %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func UpdateStoreSkusSpecTag(aa interface{}, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*StoreSkuInfo) (err error) {
|
||||
var foodDataList = []map[string]interface{}{}
|
||||
for _, v := range storeSkuList {
|
||||
var foodData = make(map[string]interface{})
|
||||
if v.IsSpecialty == -1 {
|
||||
v.IsSpecialty = 0
|
||||
}
|
||||
foodData["is_specialty"] = v.IsSpecialty
|
||||
foodData["app_food_code"] = v.SkuID
|
||||
foodDataList = append(foodDataList, foodData)
|
||||
}
|
||||
if len(foodDataList) == 1 {
|
||||
err = api.RetailInitData("1111", vendorStoreID, utils.Int2Str(storeSkuList[0].SkuID), foodDataList[0])
|
||||
} else if len(foodDataList) > 0 {
|
||||
_, err = api.RetailBatchInitData("22222", vendorStoreID, foodDataList)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
type StoreSkuInfo struct {
|
||||
SkuID int `json:"skuID,omitempty"`
|
||||
VendorSkuID string `json:"vendorSkuID,omitempty"`
|
||||
NameID int `json:"nameID,omitempty"`
|
||||
VendorNameID string `json:"vendorNameID,omitempty"`
|
||||
|
||||
Stock int `json:"stock,omitempty"`
|
||||
VendorPrice int64 `json:"price,omitempty"`
|
||||
Status int `json:"status,omitempty"`
|
||||
|
||||
Seq int `json:"seq,omitempty"`
|
||||
|
||||
ActPrice int64 `json:"actPrice,omitempty"`
|
||||
VendorActID string `json:"vendorActID,omitempty"`
|
||||
IsSpecialty int `json:"isSpecialty,omitempty"`
|
||||
JxPrice int64 `json:"jxPrice,omitempty"`
|
||||
JxUnitPrice int64 `json:"jxUnitPrice,omitempty"`
|
||||
VendorSkuID2 string `json:"vendorSkuID2,omitempty"`
|
||||
JdsStockSwitch int `json:"jdsStockSwitch"`
|
||||
IsDeletedBySku bool `json:"isDeletedBySku"`
|
||||
VendorOrgCode string `json:"vendorOrgCode"`
|
||||
SpecUnit string `json:"specUnit"`
|
||||
SpecQuality float32 `json:"specQuality"`
|
||||
|
||||
VendorMainId string `json:"vendorMainId"` // 主商品id
|
||||
VendorSkuAttrId string `json:"vendorSkuAttrId"` //主商品sku_id
|
||||
VendorSonSkuID string `json:"vendorSonSkuID"` // 子商品skuid
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user