1
This commit is contained in:
11
platformapi/ebaiapi/elm_im_test.go
Normal file
11
platformapi/ebaiapi/elm_im_test.go
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package ebaiapi
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestGetStoreImStatus(t *testing.T) {
|
||||||
|
data, err := api.GetStoreIMStatus("1139781155")
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("%v", err)
|
||||||
|
}
|
||||||
|
t.Log(data)
|
||||||
|
}
|
||||||
@@ -1,6 +1,16 @@
|
|||||||
package ebaiapi
|
package ebaiapi
|
||||||
|
|
||||||
// GetStoreIMStatus 获取门店的im状态
|
import "errors"
|
||||||
func (a *API) GetStoreIMStatus(platformShopId string) {
|
|
||||||
|
|
||||||
|
// GetStoreIMStatus 获取门店的im状态
|
||||||
|
func (a *API) GetStoreIMStatus(platformShopId string) (int, error) {
|
||||||
|
result, err := a.AccessAPI("im.getIMStatus", map[string]interface{}{"platformShopId": platformShopId})
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
if result.ErrNo != 0 {
|
||||||
|
return 0, errors.New(result.Error)
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.Data.(map[string]interface{})["imStatus"].(int), nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ type RetailDiscountActData struct {
|
|||||||
Stock int `json:"stock,omitempty"` // 当日剩余活动商品数量。只有当发起查询时间处于活动生效时段内时(start_time、end_time、period、weeks_time均需满足),该字段才代表实际剩余活动商品数量,否则显示的是创建活动时规定的当日活动库存
|
Stock int `json:"stock,omitempty"` // 当日剩余活动商品数量。只有当发起查询时间处于活动生效时段内时(start_time、end_time、period、weeks_time均需满足),该字段才代表实际剩余活动商品数量,否则显示的是创建活动时规定的当日活动库存
|
||||||
Status int `json:"status,omitempty"` // 活动状态,0:已过期,1:已生效,2:待生效。
|
Status int `json:"status,omitempty"` // 活动状态,0:已过期,1:已生效,2:待生效。
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
SkuId string `json:"sku_id"` // 京西商品id
|
//SkuId string `json:"sku_id"` // 京西商品id
|
||||||
}
|
}
|
||||||
|
|
||||||
type RetailDiscountActResult struct {
|
type RetailDiscountActResult struct {
|
||||||
|
|||||||
@@ -76,78 +76,6 @@ func TestRetailDiscountBatchSave(t *testing.T) {
|
|||||||
SettingType: SettingTypeAsDiscount,
|
SettingType: SettingTypeAsDiscount,
|
||||||
DiscountCoefficient: 9,
|
DiscountCoefficient: 9,
|
||||||
},
|
},
|
||||||
//&RetailDiscountActData{
|
|
||||||
// AppFoodCode: "6043140",
|
|
||||||
// StartTime: time.Now().Unix(),
|
|
||||||
// EndTime: time.Now().Add(24 * time.Hour).Unix(),
|
|
||||||
// OrderLimit: 1,
|
|
||||||
// DayLimit: -1,
|
|
||||||
// SettingType: SettingTypeAsDiscount,
|
|
||||||
// DiscountCoefficient: 9.5,
|
|
||||||
//},
|
|
||||||
//&RetailDiscountActData{
|
|
||||||
// AppFoodCode: "31765",
|
|
||||||
// StartTime: time.Now().Unix(),
|
|
||||||
// EndTime: time.Now().Add(24 * time.Hour).Unix(),
|
|
||||||
// OrderLimit: 1,
|
|
||||||
// DayLimit: -1,
|
|
||||||
// SettingType: SettingTypeAsDiscount,
|
|
||||||
// DiscountCoefficient: 9.5,
|
|
||||||
//},
|
|
||||||
//&RetailDiscountActData{
|
|
||||||
// AppFoodCode: "31239",
|
|
||||||
// StartTime: time.Now().Unix(),
|
|
||||||
// EndTime: time.Now().Add(24 * time.Hour).Unix(),
|
|
||||||
// OrderLimit: 1,
|
|
||||||
// DayLimit: -1,
|
|
||||||
// SettingType: SettingTypeAsDiscount,
|
|
||||||
// DiscountCoefficient: 9.5,
|
|
||||||
//},
|
|
||||||
//&RetailDiscountActData{
|
|
||||||
// AppFoodCode: "6042282",
|
|
||||||
// StartTime: time.Now().Unix(),
|
|
||||||
// EndTime: time.Now().Add(24 * time.Hour).Unix(),
|
|
||||||
// OrderLimit: 1,
|
|
||||||
// DayLimit: -1,
|
|
||||||
// SettingType: SettingTypeAsDiscount,
|
|
||||||
// DiscountCoefficient: 9.5,
|
|
||||||
//},
|
|
||||||
//&RetailDiscountActData{
|
|
||||||
// AppFoodCode: "31901",
|
|
||||||
// StartTime: time.Now().Unix(),
|
|
||||||
// EndTime: time.Now().Add(24 * time.Hour).Unix(),
|
|
||||||
// OrderLimit: 1,
|
|
||||||
// DayLimit: -1,
|
|
||||||
// SettingType: SettingTypeAsDiscount,
|
|
||||||
// DiscountCoefficient: 9.5,
|
|
||||||
//},
|
|
||||||
//&RetailDiscountActData{
|
|
||||||
// AppFoodCode: "6043147",
|
|
||||||
// StartTime: time.Now().Unix(),
|
|
||||||
// EndTime: time.Now().Add(24 * time.Hour).Unix(),
|
|
||||||
// OrderLimit: 1,
|
|
||||||
// DayLimit: -1,
|
|
||||||
// SettingType: SettingTypeAsDiscount,
|
|
||||||
// DiscountCoefficient: 9.5,
|
|
||||||
//},
|
|
||||||
//&RetailDiscountActData{
|
|
||||||
// AppFoodCode: "30645",
|
|
||||||
// StartTime: time.Now().Unix(),
|
|
||||||
// EndTime: time.Now().Add(24 * time.Hour).Unix(),
|
|
||||||
// OrderLimit: 1,
|
|
||||||
// DayLimit: -1,
|
|
||||||
// SettingType: SettingTypeAsDiscount,
|
|
||||||
// DiscountCoefficient: 9.5,
|
|
||||||
//},
|
|
||||||
//&RetailDiscountActData{
|
|
||||||
// AppFoodCode: "30729",
|
|
||||||
// StartTime: time.Now().Unix(),
|
|
||||||
// EndTime: time.Now().Add(24 * time.Hour).Unix(),
|
|
||||||
// OrderLimit: 1,
|
|
||||||
// DayLimit: -1,
|
|
||||||
// SettingType: SettingTypeAsDiscount,
|
|
||||||
// DiscountCoefficient: 9.5,
|
|
||||||
//},
|
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -199,91 +127,92 @@ func TestSgin(t *testing.T) {
|
|||||||
fmt.Println(timestamp)
|
fmt.Println(timestamp)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBaokuanHuodong(t *testing.T) {
|
//
|
||||||
// 获取门店所有的爆款活动
|
//func TestBaokuanHuodong(t *testing.T) {
|
||||||
storeId := 668887
|
// // 获取门店所有的爆款活动
|
||||||
vendorStoreId := "17056471"
|
// storeId := 668887
|
||||||
|
// vendorStoreId := "17056471"
|
||||||
actList, _ := api.RetailDiscountList(vendorStoreId, 56)
|
//
|
||||||
if len(actList) > 0 {
|
// actList, _ := api.RetailDiscountList(vendorStoreId, 56)
|
||||||
allActivitySkuIdList := make([]string, 0, 0) // 此门店全部的折扣(爆款)活动商品
|
// if len(actList) > 0 {
|
||||||
activationActivitySkuIdList := make([]*StoreSkuInfo, 0, 0) // 此门店正在进行的折扣(爆款)活动商品
|
// allActivitySkuIdList := make([]string, 0, 0) // 此门店全部的折扣(爆款)活动商品
|
||||||
loseActivitySkuIdList := make([]*StoreSkuInfo, 0, 0) // 此门店已经结束的折扣(爆款)活动商品
|
// activationActivitySkuIdList := make([]*StoreSkuInfo, 0, 0) // 此门店正在进行的折扣(爆款)活动商品
|
||||||
for _, ac := range actList {
|
// loseActivitySkuIdList := make([]*StoreSkuInfo, 0, 0) // 此门店已经结束的折扣(爆款)活动商品
|
||||||
allActivitySkuIdList = append(allActivitySkuIdList, utils.Int64ToStr(ac.ItemID))
|
// for _, ac := range actList {
|
||||||
// 已经生效的爆款活动
|
// allActivitySkuIdList = append(allActivitySkuIdList, utils.Int64ToStr(ac.ItemID))
|
||||||
if ac.Status == 1 && ac.SkuId != "" {
|
// // 已经生效的爆款活动
|
||||||
activity := &StoreSkuInfo{
|
// if ac.Status == 1 && ac.SkuId != "" {
|
||||||
SkuID: utils.Str2Int(ac.SkuId),
|
// activity := &StoreSkuInfo{
|
||||||
IsSpecialty: 1,
|
// SkuID: utils.Str2Int(ac.SkuId),
|
||||||
}
|
// IsSpecialty: 1,
|
||||||
activationActivitySkuIdList = append(activationActivitySkuIdList, activity)
|
// }
|
||||||
}
|
// activationActivitySkuIdList = append(activationActivitySkuIdList, activity)
|
||||||
// 已经失效的爆款活动
|
// }
|
||||||
if ac.Status == 0 && ac.SkuId != "" {
|
// // 已经失效的爆款活动
|
||||||
lose := &StoreSkuInfo{
|
// if ac.Status == 0 && ac.SkuId != "" {
|
||||||
SkuID: utils.Str2Int(ac.SkuId),
|
// lose := &StoreSkuInfo{
|
||||||
IsSpecialty: 0,
|
// SkuID: utils.Str2Int(ac.SkuId),
|
||||||
}
|
// IsSpecialty: 0,
|
||||||
loseActivitySkuIdList = append(loseActivitySkuIdList, lose)
|
// }
|
||||||
}
|
// 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, loseActivitySkuIdList); err != nil {
|
||||||
}
|
// globals.SugarLogger.Debugf("取消力荐错误:= %v", err)
|
||||||
// 重新推荐力荐商品
|
// }
|
||||||
if err := UpdateStoreSkusSpecTag(nil, "589", storeId, vendorStoreId, activationActivitySkuIdList); 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{}{}
|
//func UpdateStoreSkusSpecTag(aa interface{}, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*StoreSkuInfo) (err error) {
|
||||||
for _, v := range storeSkuList {
|
// var foodDataList = []map[string]interface{}{}
|
||||||
var foodData = make(map[string]interface{})
|
// for _, v := range storeSkuList {
|
||||||
if v.IsSpecialty == -1 {
|
// var foodData = make(map[string]interface{})
|
||||||
v.IsSpecialty = 0
|
// if v.IsSpecialty == -1 {
|
||||||
}
|
// v.IsSpecialty = 0
|
||||||
foodData["is_specialty"] = v.IsSpecialty
|
// }
|
||||||
foodData["app_food_code"] = v.SkuID
|
// foodData["is_specialty"] = v.IsSpecialty
|
||||||
foodDataList = append(foodDataList, foodData)
|
// 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])
|
// if len(foodDataList) == 1 {
|
||||||
} else if len(foodDataList) > 0 {
|
// err = api.RetailInitData("1111", vendorStoreID, utils.Int2Str(storeSkuList[0].SkuID), foodDataList[0])
|
||||||
_, err = api.RetailBatchInitData("22222", vendorStoreID, foodDataList)
|
// } else if len(foodDataList) > 0 {
|
||||||
}
|
// _, err = api.RetailBatchInitData("22222", vendorStoreID, foodDataList)
|
||||||
return err
|
// }
|
||||||
}
|
// return err
|
||||||
|
//}
|
||||||
type StoreSkuInfo struct {
|
//
|
||||||
SkuID int `json:"skuID,omitempty"`
|
//type StoreSkuInfo struct {
|
||||||
VendorSkuID string `json:"vendorSkuID,omitempty"`
|
// SkuID int `json:"skuID,omitempty"`
|
||||||
NameID int `json:"nameID,omitempty"`
|
// VendorSkuID string `json:"vendorSkuID,omitempty"`
|
||||||
VendorNameID string `json:"vendorNameID,omitempty"`
|
// NameID int `json:"nameID,omitempty"`
|
||||||
|
// VendorNameID string `json:"vendorNameID,omitempty"`
|
||||||
Stock int `json:"stock,omitempty"`
|
//
|
||||||
VendorPrice int64 `json:"price,omitempty"`
|
// Stock int `json:"stock,omitempty"`
|
||||||
Status int `json:"status,omitempty"`
|
// VendorPrice int64 `json:"price,omitempty"`
|
||||||
|
// Status int `json:"status,omitempty"`
|
||||||
Seq int `json:"seq,omitempty"`
|
//
|
||||||
|
// Seq int `json:"seq,omitempty"`
|
||||||
ActPrice int64 `json:"actPrice,omitempty"`
|
//
|
||||||
VendorActID string `json:"vendorActID,omitempty"`
|
// ActPrice int64 `json:"actPrice,omitempty"`
|
||||||
IsSpecialty int `json:"isSpecialty,omitempty"`
|
// VendorActID string `json:"vendorActID,omitempty"`
|
||||||
JxPrice int64 `json:"jxPrice,omitempty"`
|
// IsSpecialty int `json:"isSpecialty,omitempty"`
|
||||||
JxUnitPrice int64 `json:"jxUnitPrice,omitempty"`
|
// JxPrice int64 `json:"jxPrice,omitempty"`
|
||||||
VendorSkuID2 string `json:"vendorSkuID2,omitempty"`
|
// JxUnitPrice int64 `json:"jxUnitPrice,omitempty"`
|
||||||
JdsStockSwitch int `json:"jdsStockSwitch"`
|
// VendorSkuID2 string `json:"vendorSkuID2,omitempty"`
|
||||||
IsDeletedBySku bool `json:"isDeletedBySku"`
|
// JdsStockSwitch int `json:"jdsStockSwitch"`
|
||||||
VendorOrgCode string `json:"vendorOrgCode"`
|
// IsDeletedBySku bool `json:"isDeletedBySku"`
|
||||||
SpecUnit string `json:"specUnit"`
|
// VendorOrgCode string `json:"vendorOrgCode"`
|
||||||
SpecQuality float32 `json:"specQuality"`
|
// SpecUnit string `json:"specUnit"`
|
||||||
|
// SpecQuality float32 `json:"specQuality"`
|
||||||
VendorMainId string `json:"vendorMainId"` // 主商品id
|
//
|
||||||
VendorSkuAttrId string `json:"vendorSkuAttrId"` //主商品sku_id
|
// VendorMainId string `json:"vendorMainId"` // 主商品id
|
||||||
VendorSonSkuID string `json:"vendorSonSkuID"` // 子商品skuid
|
// VendorSkuAttrId string `json:"vendorSkuAttrId"` //主商品sku_id
|
||||||
}
|
// VendorSonSkuID string `json:"vendorSonSkuID"` // 子商品skuid
|
||||||
|
//}
|
||||||
|
|||||||
Reference in New Issue
Block a user