Merge branch 'master' of e.coding.net:rosydev/baseapi
This commit is contained in:
@@ -227,6 +227,8 @@ var (
|
|||||||
"403": 1,
|
"403": 1,
|
||||||
}
|
}
|
||||||
pageCanRetryCodes = map[string]int{}
|
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 (
|
const (
|
||||||
@@ -537,3 +539,17 @@ func (a *API) SaveQualify(stationNo string, actionType int, qualifyList []*Quali
|
|||||||
}, true, "")
|
}, true, "")
|
||||||
return err
|
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
|
package jdapi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.rosy.net.cn/baseapi"
|
"git.rosy.net.cn/baseapi"
|
||||||
@@ -189,3 +190,11 @@ func TestSaveQualify(t *testing.T) {
|
|||||||
t.Fatal(err)
|
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