根据名字查询京东门店等级修改
This commit is contained in:
@@ -755,26 +755,21 @@ func (a *API) IsJdManagerUser(id int64) (isManager bool, err error) {
|
||||
// 查询京东门店等级
|
||||
// 无法得到总数,循环50页后放弃寻找。。
|
||||
// https://sta-store.jddj.com/store/logquery?venderId=320406&stationNo=11733018¤tPage=1&pageSize=20
|
||||
func (a *API) GetJdStoreLevel(vendorOrgCode, vendorStoreID string) (level string, err error) {
|
||||
for i := 1; i < 51; i++ {
|
||||
jdParams := map[string]interface{}{
|
||||
"venderId": vendorOrgCode,
|
||||
"stationNo": vendorStoreID,
|
||||
"currentPage": i,
|
||||
"pageSize": 20,
|
||||
}
|
||||
body, err := a.AccessStorePage2("https://sta-store.jddj.com/store/logquery", jdParams, false, "")
|
||||
if err != nil {
|
||||
return "0", err
|
||||
}
|
||||
bodyStr := body.(string)
|
||||
levelList := regexpJDStoreLevel.FindAllStringSubmatch(bodyStr, 1)
|
||||
if len(levelList) > 0 {
|
||||
level = levelList[0][1]
|
||||
}
|
||||
if level != "" {
|
||||
break
|
||||
}
|
||||
func (a *API) GetJdStoreLevel(vendorOrgCode, vendorStoreID string, currentPage int) (level string, err error) {
|
||||
jdParams := map[string]interface{}{
|
||||
"venderId": vendorOrgCode,
|
||||
"stationNo": vendorStoreID,
|
||||
"currentPage": currentPage,
|
||||
"pageSize": 20,
|
||||
}
|
||||
body, err := a.AccessStorePage2("https://sta-store.jddj.com/store/logquery", jdParams, false, "")
|
||||
if err != nil {
|
||||
return "0", err
|
||||
}
|
||||
bodyStr := body.(string)
|
||||
levelList := regexpJDStoreLevel.FindAllStringSubmatch(bodyStr, 1)
|
||||
if len(levelList) > 0 {
|
||||
level = levelList[0][1]
|
||||
}
|
||||
return level, err
|
||||
}
|
||||
@@ -808,9 +803,8 @@ func (a *API) GetJdUpcCodeByName(name, upcCode string, pageNo, pageSize int) (pr
|
||||
}
|
||||
productInfo := &ProductInfo{
|
||||
OriginalName: v.(map[string]interface{})["name"].(string),
|
||||
Name: v.(map[string]interface{})["name"].(string),
|
||||
UpcCode: v.(map[string]interface{})["upcCode"].(string),
|
||||
Weight: float32(utils.Interface2Float64WithDefault(v.(map[string]interface{})["weight"], 0)),
|
||||
Weight: float32(utils.Interface2Float64WithDefault(v.(map[string]interface{})["weight"], 0) * 1000),
|
||||
ImgList: ImgList,
|
||||
}
|
||||
productInfos = append(productInfos, productInfo)
|
||||
|
||||
Reference in New Issue
Block a user