Merge branch 'master' of e.coding.net:rosydev/baseapi
This commit is contained in:
@@ -227,6 +227,8 @@ var (
|
||||
"403": 1,
|
||||
}
|
||||
pageCanRetryCodes = map[string]int{}
|
||||
regexpTable = regexp.MustCompile(`<table class="check-container" data-container="list1">([\s\S]*?)</table>`)
|
||||
regexpTd = regexp.MustCompile(`<td>([0-9].*)</td>`)
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -537,3 +539,17 @@ func (a *API) SaveQualify(stationNo string, actionType int, qualifyList []*Quali
|
||||
}, true, "")
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *API) GetJdUserBindStoreIDs(userID int) (vendorStoreIDs []string, err error) {
|
||||
body, err := a.AccessStorePage2("https://login-o2o.jddj.com/jpuser/bindStore/"+utils.Int2Str(userID), nil, false, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
bodyStr := body.(string)
|
||||
tableStr := regexpTable.FindString(bodyStr)
|
||||
vendorStoreIDsRegexp := regexpTd.FindAllStringSubmatch(tableStr, -1)
|
||||
for _, v := range vendorStoreIDsRegexp {
|
||||
vendorStoreIDs = append(vendorStoreIDs, v[1])
|
||||
}
|
||||
return vendorStoreIDs, err
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package jdapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"git.rosy.net.cn/baseapi"
|
||||
@@ -189,3 +190,11 @@ func TestSaveQualify(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetJdUserBindStoreIDs(t *testing.T) {
|
||||
vv, err := api.GetJdUserBindStoreIDs(339890)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
fmt.Println(vv)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user