- store page api for ebai.
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"net/url"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"git.rosy.net.cn/baseapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi"
|
||||
@@ -19,6 +20,11 @@ const (
|
||||
signKey = "sign"
|
||||
secretKey = "secret"
|
||||
)
|
||||
|
||||
const (
|
||||
ResponseCodeSuccess = 0
|
||||
)
|
||||
|
||||
const (
|
||||
CmdOrderCreate = "order.create"
|
||||
CmdOrderDeliveryStatus = "order.deliveryStatus.push"
|
||||
@@ -40,6 +46,9 @@ type API struct {
|
||||
client *http.Client
|
||||
config *platformapi.APIConfig
|
||||
speedLimiter *platformapi.Limiter
|
||||
|
||||
locker sync.RWMutex
|
||||
storeCookies map[string]string
|
||||
}
|
||||
|
||||
func New(source, secret string, config ...*platformapi.APIConfig) *API {
|
||||
@@ -54,6 +63,7 @@ func New(source, secret string, config ...*platformapi.APIConfig) *API {
|
||||
client: &http.Client{Timeout: curConfig.ClientTimeout},
|
||||
config: &curConfig,
|
||||
speedLimiter: platformapi.New(apiLimitConfigs, defaultAPILimitConfig),
|
||||
storeCookies: make(map[string]string),
|
||||
}
|
||||
return api
|
||||
}
|
||||
@@ -105,7 +115,7 @@ func (a *API) AccessAPI(cmd string, body map[string]interface{}) (retVal *Respon
|
||||
Error: utils.Interface2String(Body["error"]),
|
||||
Data: Body["data"],
|
||||
}
|
||||
if retVal.ErrNo == 0 {
|
||||
if retVal.ErrNo == ResponseCodeSuccess {
|
||||
return platformapi.ErrLevelSuccess, nil
|
||||
}
|
||||
baseapi.SugarLogger.Debugf("ebai AccessAPI failed, jsonResult1:%s", utils.Format4Output(jsonResult1, true))
|
||||
|
||||
Reference in New Issue
Block a user