1
This commit is contained in:
@@ -26,7 +26,7 @@ func init() {
|
|||||||
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
|
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
|
||||||
|
|
||||||
//商超
|
//商超
|
||||||
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_lFmVkpgE8Jevux4i9IdISA") //token_n4TwqCntWWuvQwAawzxC0w
|
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_rzfK3TvMXrIDIlIT3s5CSg") //token_n4TwqCntWWuvQwAawzxC0w
|
||||||
cookieStr := `
|
cookieStr := `
|
||||||
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
|
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
|
||||||
`
|
`
|
||||||
|
|||||||
@@ -434,6 +434,7 @@ func (a *API) RetailSkuSave(poiCode, foodCode string, standardSkus, unstandardSk
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RetailDelete 根据APP方门店id和商品id,删除商品。
|
||||||
func (a *API) RetailDelete(trackInfo, poiCode, foodCode string) (err error) {
|
func (a *API) RetailDelete(trackInfo, poiCode, foodCode string) (err error) {
|
||||||
_, err = a.AccessAPI2("retail/delete", false, map[string]interface{}{
|
_, err = a.AccessAPI2("retail/delete", false, map[string]interface{}{
|
||||||
KeyAppPoiCode: poiCode,
|
KeyAppPoiCode: poiCode,
|
||||||
|
|||||||
@@ -231,9 +231,10 @@ func TestBatchSetPrice(t *testing.T) {
|
|||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
func TestRetailDelete(t *testing.T) {
|
func TestRetailDelete(t *testing.T) {
|
||||||
poiCode := "18292160"
|
poiCode := "20978764"
|
||||||
|
|
||||||
i := 0
|
i := 0
|
||||||
|
count := 0
|
||||||
for {
|
for {
|
||||||
// 同步商品
|
// 同步商品
|
||||||
fromFoodList, err1 := api.RetailListAll(poiCode, i)
|
fromFoodList, err1 := api.RetailListAll(poiCode, i)
|
||||||
@@ -241,25 +242,35 @@ func TestRetailDelete(t *testing.T) {
|
|||||||
fmt.Println(fmt.Errorf("fromFoodList 为空 %s ,i:= %d", utils.Format4Output(err1, false), i))
|
fmt.Println(fmt.Errorf("fromFoodList 为空 %s ,i:= %d", utils.Format4Output(err1, false), i))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
count += len(fromFoodList)
|
||||||
|
|
||||||
stockList := make([]*BareStoreFoodInfo, 0, 100)
|
for k, v := range fromFoodList {
|
||||||
for _, fl := range fromFoodList {
|
if err := api.RetailDelete(utils.Int2Str(k), poiCode, v.AppFoodCode); err != nil {
|
||||||
stockList = append(stockList, &BareStoreFoodInfo{
|
fmt.Println(err)
|
||||||
AppFoodCode: fl.AppFoodCode,
|
}
|
||||||
Skus: []*BareStoreSkuInfo{
|
|
||||||
&BareStoreSkuInfo{
|
|
||||||
SkuID: fl.AppFoodCode,
|
|
||||||
Stock: "99999",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
//stockList := make([]*BareStoreFoodInfo, 0, 100)
|
||||||
|
//for _, fl := range fromFoodList {
|
||||||
|
// stockList = append(stockList, &BareStoreFoodInfo{
|
||||||
|
// AppFoodCode: fl.AppFoodCode,
|
||||||
|
// Skus: []*BareStoreSkuInfo{
|
||||||
|
// &BareStoreSkuInfo{
|
||||||
|
// SkuID: fl.AppFoodCode,
|
||||||
|
// Stock: "99999",
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// })
|
||||||
|
//}
|
||||||
i++
|
i++
|
||||||
|
|
||||||
result, err := api.RetailSkuStock(utils.GetUUID(), poiCode, stockList)
|
if len(fromFoodList) < 100 {
|
||||||
globals.SugarLogger.Debugf("===result :-%s", utils.Format4Output(result, false))
|
break
|
||||||
globals.SugarLogger.Debugf("===result :-%v", err)
|
}
|
||||||
|
//result, err := api.RetailSkuStock(utils.GetUUID(), poiCode, stockList)
|
||||||
|
//globals.SugarLogger.Debugf("===result :-%s", utils.Format4Output(result, false))
|
||||||
|
//globals.SugarLogger.Debugf("===result :-%v", err)
|
||||||
}
|
}
|
||||||
|
fmt.Println(count)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMap(t *testing.T) {
|
func TestMap(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user