1
This commit is contained in:
@@ -44,7 +44,7 @@ func New(appKey, appSecret, accessToken string) *API {
|
||||
expiresIn: access.ExpiresIn,
|
||||
accessTokenObj: access,
|
||||
}
|
||||
if access.ExpiresIn > time.Now().Unix() {
|
||||
if access.ExpiresIn < time.Now().Unix() {
|
||||
api.RefreshToken()
|
||||
}
|
||||
return api
|
||||
|
||||
@@ -214,7 +214,7 @@ func (a *API) GetStoreBindTemp(storeId int64) (freightId int64, err error) {
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if len(result.Data.StoreFreights) == 0 {
|
||||
if result.Data == nil || len(result.Data.StoreFreights) == 0 {
|
||||
return 0, nil
|
||||
}
|
||||
for _, v := range result.Data.StoreFreights {
|
||||
|
||||
@@ -35,3 +35,10 @@ func TestCreateStore(t *testing.T) {
|
||||
func TestSysnc(t *testing.T) {
|
||||
fmt.Println((2 & 2) != 0) // 创建
|
||||
}
|
||||
|
||||
func TestStoreTemp(t *testing.T) {
|
||||
token := `{"access_token":"a1746210-a8a3-4497-a87b-09d1f10dbb95","expires_in":1665652230,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"c1cf8d88-0983-4f2a-b969-3746fae6b0cd","authority_id":""}`
|
||||
|
||||
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
|
||||
a.GetStoreBindTemp(63114504)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user