1
This commit is contained in:
@@ -20,13 +20,13 @@ func init() {
|
||||
baseapi.Init(sugarLogger)
|
||||
|
||||
// 菜市
|
||||
api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
|
||||
//api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
|
||||
|
||||
// 果园
|
||||
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
|
||||
|
||||
//商超
|
||||
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_nH_IlcWQKAkZBqklwItNRw") //token_nH_IlcWQKAkZBqklwItNRw
|
||||
api = New("5873", "41c479790a76f86326f89e8048964739", "", "") //token_nH_IlcWQKAkZBqklwItNRw
|
||||
cookieStr := `
|
||||
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
|
||||
`
|
||||
@@ -60,7 +60,7 @@ func TestGetAccessToken(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetAccessToken2(t *testing.T) {
|
||||
result, err := api.GetAccessToken2("12422751") //refresh_token_pLG7Jw7g9mu7oOzNSuJIUg
|
||||
result, err := api.GetAccessToken2("16708848") //refresh_token_pLG7Jw7g9mu7oOzNSuJIUg
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ func TestGetOrderIdByDaySeq(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetOrderIdByDaySeqSingle(t *testing.T) {
|
||||
result, err := api.GetOrderIdByDaySeqSingle("7111597", utils.Time2Date(time.Now()), 1)
|
||||
result, err := api.GetOrderIdByDaySeqSingle("16708848", utils.Time2Date(time.Now()), 1)
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -23,7 +23,7 @@ func TestPoiGetIDs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPoiMGet(t *testing.T) {
|
||||
result, err := api.PoiMGet([]string{"12524795"})
|
||||
result, err := api.PoiMGet([]string{"16708848"})
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
)
|
||||
@@ -32,7 +33,8 @@ const ( // {"attrId":1200000275,"attrName":"是否有机","valueList":[{"valueId
|
||||
MtwmSkuAttr200002716 = `[{"attrId":1200000287,"attrName":"特产品种","valueList":[{"valueId":1300003951,"value":"非特产品种"}]},{"attrId":1200000094,"attrName":"产地","valueList":[{"valueId":100000050,"value":"中国"}]},{"attrId":1200000132,"attrName":"国产/进口","valueList":[{"valueId":1300000003,"value":"国产"}]},{"attrId":1200000286,"attrName":"果品品牌","valueList":[{"valueId":1300000249,"value":"其他"}]}]`
|
||||
//200002667,200002713
|
||||
MtwmSkuAttr200002670 = `[{"attrId":1200000202,"attrName":"品种","valueList":[{"valueId":1300000249,"value":"其他"}]},{"attrId":1200000287,"attrName":"特产品种","valueList":[{"valueId":1300003951,"value":"非特产品种"}]},{"attrId":1200000094,"attrName":"产地","valueList":[{"valueId":100000050,"value":"中国"}]},{"attrId":1200000132,"attrName":"国产/进口","valueList":[{"valueId":1300000003,"value":"国产"}]},{"attrId":1200000286,"attrName":"果品品牌","valueList":[{"valueId":1300000249,"value":"其他"}]}]`
|
||||
MtwmSkuAttr200002680 = `[{"attrId":1200000289,"attrName":"品规","valueList":[{"valueId":1300004255,"value":"未区分品规"}]},{"attrId":1200000202,"attrName":"品种","valueList":[{"valueId":1300000249,"value":"其他"}]},{"attrId":1200000094,"attrName":"产地","valueList":[{"valueId":100000050,"value":"中国"}]},{"attrId":1200000132,"attrName":"国产/进口","valueList":[{"valueId":1300000003,"value":"国产"}]},{"attrId":1200000286,"attrName":"果品品牌","valueList":[{"valueId":1300000249,"value":"其他"}]}]`
|
||||
//MtwmSkuAttr200002680 = `[{"attrId":1200000289,"attrName":"品规","valueList":[{"valueId":1300004255,"value":"未区分品规"}]},{"attrId":1200000202,"attrName":"品种","valueList":[{"valueId":1300000249,"value":"其他"}]},{"attrId":1200000094,"attrName":"产地","valueList":[{"valueId":100000050,"value":"中国"}]},{"attrId":1200000132,"attrName":"国产/进口","valueList":[{"valueId":1300000003,"value":"国产"}]},{"attrId":1200000286,"attrName":"果品品牌","valueList":[{"valueId":1300000249,"value":"其他"}]}]`
|
||||
MtwmSkuAttr200002680 = `[{"attrId":1200004607,"attrName":"水果形态","valueList":[{"valueId":1300017364,"value":"新鲜整果"}]},{"attrId":1200004608,"attrName":"单果重量","valueList":[{"valueId":1300004271,"value":"4kg~4.5kg"}]},{"attrId":1200000202,"attrName":"品种","valueList":[{"valueId":1300000249,"value":"其他"}]},{"attrId":1200000094,"attrName":"产地","valueList":[{"valueId":100000050,"value":"中国"}]},{"attrId":1200000132,"attrName":"国产/进口","valueList":[{"valueId":1300000003,"value":"国产"}]},{"attrId":1200000286,"attrName":"果品品牌","valueList":[{"valueId":1300000249,"value":"其他"}]}]`
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -177,15 +179,15 @@ func (a *API) RetailCatUpdate(poiCode, catName string, updateParams *Param4Updat
|
||||
params := utils.Struct2MapByJson(updateParams)
|
||||
params[KeyAppPoiCode] = poiCode
|
||||
params["category_name"] = catName
|
||||
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
_, err = a.AccessAPI("retailCat/update", false, params)
|
||||
return err
|
||||
}
|
||||
|
||||
// 删除商品分类
|
||||
// 当分类下存在子级分类或商品时,不允许直接删除此分类。
|
||||
func (a *API) RetailCatDelete(poiCode, code, name string) (err error) {
|
||||
globals.SugarLogger.Debugf("RetailCatDelete======poiCode %s", poiCode)
|
||||
globals.SugarLogger.Debugf("RetailCatDelete======name %s", name)
|
||||
func (a *API) RetailCatDelete(poiCode, code, name string, moveProductToUncate int) (err error) {
|
||||
params := map[string]interface{}{
|
||||
KeyAppPoiCode: poiCode,
|
||||
}
|
||||
@@ -194,10 +196,12 @@ func (a *API) RetailCatDelete(poiCode, code, name string) (err error) {
|
||||
} else {
|
||||
params["category_name"] = name
|
||||
}
|
||||
_, err = a.AccessAPI("retailCat/delete", false, params)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debugf("RetailCatDelete======err %s", err.Error())
|
||||
if moveProductToUncate != 0 {
|
||||
params["move_product_to_uncate"] = 1 // 分类存在商品时将商品转移到未分类当中
|
||||
}
|
||||
|
||||
_, err = a.AccessAPI("retailCat/delete", false, params)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -205,11 +209,6 @@ func (a *API) RetailCatList(poiCode string) (retailCatList []*RetailCategoryInfo
|
||||
result, err := a.AccessAPI("retailCat/list", true, map[string]interface{}{
|
||||
KeyAppPoiCode: poiCode,
|
||||
})
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debugf("RetailCatList==========err %v", err)
|
||||
}
|
||||
globals.SugarLogger.Debugf("result==========err %s", utils.Format4Output(result, false))
|
||||
|
||||
if err == nil {
|
||||
return interface2CatList(result, 1, nil), nil
|
||||
}
|
||||
@@ -503,11 +502,10 @@ func (a *API) BatchSetRestockingPrice(trackInfo, appPoiCode string, spuData []*S
|
||||
globals.SugarLogger.Debugf("BatchSetRestockingPrice params======%s %s %s", v.PurchasePrice, v.AppSpuCode, v.SkuID)
|
||||
}
|
||||
}
|
||||
retVal, err := a.AccessAPI2("/retail/purchase/price/update", false, map[string]interface{}{
|
||||
_, err := a.AccessAPI2("/retail/purchase/price/update", false, map[string]interface{}{
|
||||
KeyAppPoiCode: appPoiCode,
|
||||
"spu_data": spuData,
|
||||
}, resultKeyMsg, trackInfo)
|
||||
globals.SugarLogger.Debugf("BatchSetRestockingPrice retVal====%v err===========%v", retVal, err)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user