- 内嵌APICookie后,删除一些冗余的数据成员
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"net/url"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"git.rosy.net.cn/baseapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi"
|
||||
@@ -43,9 +42,6 @@ type API struct {
|
||||
config *platformapi.APIConfig
|
||||
speedLimiter *platformapi.Limiter
|
||||
supplierID int64
|
||||
|
||||
locker sync.RWMutex
|
||||
storeCookies map[string]string
|
||||
}
|
||||
|
||||
func New(source, secret string, config ...*platformapi.APIConfig) *API {
|
||||
@@ -60,7 +56,6 @@ func New(source, secret string, config ...*platformapi.APIConfig) *API {
|
||||
client: &http.Client{Timeout: curConfig.ClientTimeout},
|
||||
config: &curConfig,
|
||||
speedLimiter: platformapi.New(apiLimitConfigs, nil), //defaultAPILimitConfig),
|
||||
storeCookies: make(map[string]string),
|
||||
|
||||
supplierID: -1,
|
||||
}
|
||||
@@ -155,12 +150,12 @@ func (a *API) AccessAPI(cmd string, body map[string]interface{}) (retVal *Respon
|
||||
}
|
||||
|
||||
func (a *API) GetSupplierID() (supplierID int64) {
|
||||
a.locker.RLock()
|
||||
a.RLock()
|
||||
supplierID = a.supplierID
|
||||
a.locker.RUnlock()
|
||||
a.RUnlock()
|
||||
if supplierID < 0 {
|
||||
a.locker.Lock()
|
||||
defer a.locker.Unlock()
|
||||
a.Lock()
|
||||
defer a.Unlock()
|
||||
|
||||
a.supplierID = 0
|
||||
if shopList, err := a.ShopList(SysStatusAll); err == nil {
|
||||
|
||||
Reference in New Issue
Block a user