获取京东用户列表接口修改

This commit is contained in:
苏尹岚
2019-11-29 14:34:40 +08:00
parent 7b5f849ff8
commit 581b544864

View File

@@ -263,8 +263,9 @@ var (
regexpTable = regexp.MustCompile(`<table class="check-container" data-container="list1">([\s\S]*?)</table>`)
regexpTd = regexp.MustCompile(`<td>([0-9].*)</td>`)
regexpJDUserPage = regexp.MustCompile(`共([\s\S].*)页/([\s\S].*)条记录`)
regexpJDUserList = regexp.MustCompile(`<input type="checkbox"></td>([\s\S]*?)<input`)
regexpJDUserInfo = regexp.MustCompile(`<td>(.*)</td>`)
regexpJDTr = regexp.MustCompile(`<tr>([\s\S]*?)</tr>`)
regexpJDUserInfo = regexp.MustCompile(`<td>([\s\S]*?)</td>`)
regexpJDUserID = regexp.MustCompile(`value="(.*)"`)
)
const (
@@ -594,24 +595,31 @@ func (a *API) GetJdUserBindStoreIDs(userID int) (vendorStoreIDs []string, err er
// https://login-o2o.jddj.com/jpuser/list?doPage=false&pageNo=1&appCode=lsp-store&pageSize=20&autoCount=false&_=1574936207872
func (a *API) PrivilegeSearchUser(pageNo int) (storeUserList []*StoreUserInfo, totalCount, totalPage int, err error) {
params := map[string]interface{}{
"pageNo": pageNo,
"appCode": "lsp-store",
"pageNo": pageNo,
"appCode": "lsp-store",
"doPage": false,
"autoCount": false,
"pageSize": 20,
}
body, err := a.AccessStorePage2("https://login-o2o.jddj.com/jpuser/list", params, false, "")
if err != nil {
return nil, 0, 0, err
}
bodyStr := body.(string)
list := regexpJDUserList.FindAllStringSubmatch(bodyStr, -1)
list := regexpJDTr.FindAllStringSubmatch(bodyStr, -1)
totalCount = int(utils.Str2Int64(regexpJDUserPage.FindStringSubmatch(bodyStr)[2]))
totalPage = int(utils.Str2Int64(regexpJDUserPage.FindStringSubmatch(bodyStr)[1]))
for _, v := range list {
tdList := regexpJDUserInfo.FindAllStringSubmatch(v[1], -1)
storeUserInfo := &StoreUserInfo{
LoginName: tdList[0][1],
LockStatus: tdList[9][1],
if len(tdList) > 0 {
id := regexpJDUserID.FindStringSubmatch(tdList[10][0])[1]
storeUserInfo := &StoreUserInfo{
LoginName: tdList[0][1],
LockStatus: tdList[9][1],
ID: int(utils.Str2Int64(id)),
}
storeUserList = append(storeUserList, storeUserInfo)
}
storeUserList = append(storeUserList, storeUserInfo)
}
return storeUserList, totalCount, totalPage, err
}