+SetJdCookie
This commit is contained in:
@@ -29,8 +29,7 @@ func init() {
|
|||||||
|
|
||||||
// const cookieValue = "YYJV3NHVBPHLD36FWP6F3EM5PTXJ2XZQS7U4HWRIDPP4IWGUKUIB4XG5N26CZRDLDF7PKOXBPD6BNTUAJLETLZOIWMCVFI3K6MYZIY4QBIXIMXYDJNUKFGJVQTN5356SAD6WPCIHWNQAG7DDMF7L7S3SHCT3RM3CQG7IJIPUQ3THS5UIUYWMKINM7ETUOQB7OBPOPZVCT3ZJY55243TDVXLO25PP4UYSPTTPMNQ7HPMWOJKJ3BJWGVHD243MXH7NZWW264TKN5UOCJBSSSOKD2QQII"
|
// const cookieValue = "YYJV3NHVBPHLD36FWP6F3EM5PTXJ2XZQS7U4HWRIDPP4IWGUKUIB4XG5N26CZRDLDF7PKOXBPD6BNTUAJLETLZOIWMCVFI3K6MYZIY4QBIXIMXYDJNUKFGJVQTN5356SAD6WPCIHWNQAG7DDMF7L7S3SHCT3RM3CQG7IJIPUQ3THS5UIUYWMKINM7ETUOQB7OBPOPZVCT3ZJY55243TDVXLO25PP4UYSPTTPMNQ7HPMWOJKJ3BJWGVHD243MXH7NZWW264TKN5UOCJBSSSOKD2QQII"
|
||||||
const cookieValue = "OPJQMA7B3FTKCAUGO7FHCH5NMBGAWGGXYRNLEHYYZNGNPNIBCAM4IOEPG3NT3RIA44G5C3535Q5LGG4F4SR4AZVLGYKYTKFJJKEAOXENVBL5VXNILRP3GLNVVWA26XZ3VGSYOHA72RICMVZS3G53DTEH3KT7YNE5MGHU5WW5LDCHTOOO5R6GWEZMJRYHHF6BVS34XSSAHTZF3ZDGLFDYP6VTY3ASMV4YHJEA7RWCAHAMXKJ2VBGHTZYRL2DHR3BMXAHCTBAHYQLL24K5YI2PULRJL2UGAVD7VFRMEYTOXYHWCYVDXJ6HYFIPWIN3ULLXDDLN2ICON4GRK"
|
const cookieValue = "OPJQMA7B3FTKCAUGO7FHCH5NMBGAWGGXYRNLEHYYZNGNPNIBCAM4IOEPG3NT3RIA44G5C3535Q5LGG4F4SR4AZVLGYKYTKFJJKEAOXENVBL5VXNILRP3GLNVVWA26XZ3VGSYOHA72RICMVZS3G53DTEH3KT7YNE5MGHU5WW5LDCHTOOO5R6GWEZMJRYHHF6BVS34XSSAHTZF3ZDGLFDYP6VTY3ASMV4YHJEA7RWCAHAMXKJ2VBGHTZYRL2DHR3BMXAHCTBAHYQLL24K5YI2PULRJL2UGAVD7VFRMEYTOXYHWCYVDXJ6HYFIPWIN3ULLXDDLN2ICON4GRK"
|
||||||
api.SetCookie(accessStorePageCookieName, cookieValue)
|
api.SetJdCookie(cookieValue)
|
||||||
api.SetCookie(accessStorePageCookieName2, cookieValue)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTest(t *testing.T) {
|
func TestTest(t *testing.T) {
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ const (
|
|||||||
getStoreURL = "https://daojia.jd.com"
|
getStoreURL = "https://daojia.jd.com"
|
||||||
accessStorePageCookieName = "shop.o2o.jd.com1"
|
accessStorePageCookieName = "shop.o2o.jd.com1"
|
||||||
accessStorePageCookieName2 = "lsp-store1.jddj.com"
|
accessStorePageCookieName2 = "lsp-store1.jddj.com"
|
||||||
|
accessStorePageCookieName3 = "josl-privilege1.jddj.com"
|
||||||
|
|
||||||
|
htmlResponeURL = "login-o2o.jddj.com/jpuser/"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SkuPageImg struct {
|
type SkuPageImg struct {
|
||||||
@@ -234,6 +237,12 @@ const (
|
|||||||
ResultKeyResult = "result"
|
ResultKeyResult = "result"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func (a *API) SetJdCookie(cookieValue string) {
|
||||||
|
a.SetCookie(accessStorePageCookieName, cookieValue)
|
||||||
|
a.SetCookie(accessStorePageCookieName2, cookieValue)
|
||||||
|
a.SetCookie(accessStorePageCookieName3, cookieValue)
|
||||||
|
}
|
||||||
|
|
||||||
func (a *API) AccessStorePage2(fullURL string, params map[string]interface{}, isPost bool, resultKey string) (retVal interface{}, err error) {
|
func (a *API) AccessStorePage2(fullURL string, params map[string]interface{}, isPost bool, resultKey string) (retVal interface{}, err error) {
|
||||||
if a.GetCookieCount() == 0 {
|
if a.GetCookieCount() == 0 {
|
||||||
return nil, fmt.Errorf("需要设置Store Cookie才能使用此方法")
|
return nil, fmt.Errorf("需要设置Store Cookie才能使用此方法")
|
||||||
@@ -281,7 +290,7 @@ func (a *API) AccessStorePage2(fullURL string, params map[string]interface{}, is
|
|||||||
if jsonResult1 == nil {
|
if jsonResult1 == nil {
|
||||||
return platformapi.ErrLevelRecoverableErr, fmt.Errorf("mapData is nil")
|
return platformapi.ErrLevelRecoverableErr, fmt.Errorf("mapData is nil")
|
||||||
}
|
}
|
||||||
if jsonResult1[platformapi.KeyData] != nil {
|
if strings.Index(fullURL, htmlResponeURL) >= 0 && jsonResult1[platformapi.KeyData] != nil {
|
||||||
retVal = bodyStr
|
retVal = bodyStr
|
||||||
return platformapi.ErrLevelSuccess, nil
|
return platformapi.ErrLevelSuccess, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user