京东修改门店状态无效,临时修改
This commit is contained in:
@@ -22,6 +22,7 @@ const (
|
||||
AccessStorePageCookieName2 = "lsp-store1.jddj.com"
|
||||
accessStorePageCookieName3 = "josl-privilege1.jddj.com"
|
||||
accessStorePageCookieName4 = "o2o-stock1.jddj.com"
|
||||
accessStorePageCookieName5 = "sta-store.jddj.com"
|
||||
)
|
||||
|
||||
type SkuPageImg struct {
|
||||
@@ -305,10 +306,12 @@ var (
|
||||
regexpJDUserIsManager = regexp.MustCompile(`<div class="list-mask">`)
|
||||
regexpJDStoreLevel = regexp.MustCompile(`门店分级 :(.*);`)
|
||||
regexpJDSkuDirectPrice = regexp.MustCompile(`<td style="max-width: 80px">([\s\S]*?)</td>`)
|
||||
regexpJDStoreID = regexp.MustCompile(`<input class="storeInfoId" type="hidden" value="(.*?)"/>`)
|
||||
htmlResponeURLs = []string{
|
||||
"login-o2o.jddj.com/jpuser/",
|
||||
"sta-store.jddj.com/store/",
|
||||
"pms-store.jddj.com/ware",
|
||||
"sta-store.jddj.com",
|
||||
}
|
||||
)
|
||||
|
||||
@@ -329,6 +332,8 @@ func (a *API) SetJdCookie(cookieValue string) {
|
||||
a.SetCookie(AccessStorePageCookieName2, cookieValue)
|
||||
a.SetCookie(accessStorePageCookieName3, cookieValue)
|
||||
a.SetCookie(accessStorePageCookieName4, cookieValue)
|
||||
a.SetCookie(accessStorePageCookieName5, cookieValue)
|
||||
|
||||
}
|
||||
|
||||
func (a *API) AccessStorePage2(fullURL string, params map[string]interface{}, isPost bool, resultKey string) (retVal interface{}, err error) {
|
||||
@@ -905,3 +910,35 @@ func (a *API) SearchDeleteWare(deleteTimeStart, deleteTimeEnd string, page, page
|
||||
}
|
||||
return searchDeleteWareResults, err
|
||||
}
|
||||
|
||||
//获取京东的门店信息(内部id)
|
||||
//https://sta-store.jddj.com/store/query
|
||||
func (a *API) GetJdStoreID(storeID int) (jdStoreID int, err error) {
|
||||
jdParams := map[string]interface{}{
|
||||
"outSystemId": storeID,
|
||||
"pageSize": 10,
|
||||
}
|
||||
body, err := a.AccessStorePage2("https://sta-store.jddj.com/store/query", jdParams, true, "")
|
||||
if body != nil {
|
||||
result := regexpJDStoreID.FindStringSubmatch(body.(string))
|
||||
if len(result) > 0 {
|
||||
if result[1] != "" {
|
||||
return int(utils.Str2Int64(result[1])), err
|
||||
} else {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
|
||||
//更新京东门店营业状态
|
||||
//https://sta-store.jddj.com/store/updateClosetStatus
|
||||
func (a *API) UpdateClosetStatus(jdStoreID, closeStatus int) (err error) {
|
||||
jdParams := map[string]interface{}{
|
||||
"id": jdStoreID,
|
||||
"closeStatus": closeStatus,
|
||||
}
|
||||
_, err = a.AccessStorePage2("https://sta-store.jddj.com/store/updateClosetStatus", jdParams, true, "")
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user