- 内嵌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 {
|
||||
|
||||
@@ -16,7 +16,7 @@ func TestShopCategoryCreate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestShopCategoryGet(t *testing.T) {
|
||||
result, err := api.ShopCategoryGet("102493")
|
||||
result, err := api.ShopCategoryGet("300034")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
@@ -69,7 +69,7 @@ func TestSkuUploadRTF(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSkuCreate(t *testing.T) {
|
||||
result, err := api.SkuCreate(testShopID, 17, map[string]interface{}{
|
||||
result, err := api.SkuCreate("", testShopID, 17, map[string]interface{}{
|
||||
"name": "测试商品",
|
||||
"status": SkuStatusOnline,
|
||||
"left_num": MaxLeftNum,
|
||||
|
||||
Reference in New Issue
Block a user