银豹cookie过期修改

This commit is contained in:
苏尹岚
2020-03-26 15:34:36 +08:00
parent 18a8fded54
commit ee63b9c19d
2 changed files with 23 additions and 8 deletions

View File

@@ -18,6 +18,7 @@ const (
func (a *API) AccessStorePage(action string, bizParams map[string]interface{}) (retVal map[string]interface{}, err error) { func (a *API) AccessStorePage(action string, bizParams map[string]interface{}) (retVal map[string]interface{}, err error) {
fullURL := utils.GenerateGetURL(pageUrl, action, nil) fullURL := utils.GenerateGetURL(pageUrl, action, nil)
a.addPageCount()
// result, _ := json.MarshalIndent(bizParams, "", " ") // result, _ := json.MarshalIndent(bizParams, "", " ")
err = platformapi.AccessPlatformAPIWithRetry(a.client, err = platformapi.AccessPlatformAPIWithRetry(a.client,
func() *http.Request { func() *http.Request {

View File

@@ -34,10 +34,23 @@ const (
type API struct { type API struct {
platformapi.APICookie platformapi.APICookie
appKey string appKey string
appID string appID string
client *http.Client pageCount int
config *platformapi.APIConfig client *http.Client
config *platformapi.APIConfig
}
func (a *API) setPageCount(pc int) {
a.pageCount = pc
}
func (a *API) GetPageCount() int {
return a.pageCount
}
func (a *API) addPageCount() {
a.setPageCount(a.GetPageCount() + 1)
} }
func New(appKey, appID string, config ...*platformapi.APIConfig) *API { func New(appKey, appID string, config ...*platformapi.APIConfig) *API {
@@ -46,10 +59,11 @@ func New(appKey, appID string, config ...*platformapi.APIConfig) *API {
curConfig = *config[0] curConfig = *config[0]
} }
return &API{ return &API{
appKey: appKey, appKey: appKey,
appID: appID, appID: appID,
client: &http.Client{Timeout: curConfig.ClientTimeout}, pageCount: 1,
config: &curConfig, client: &http.Client{Timeout: curConfig.ClientTimeout},
config: &curConfig,
} }
} }