添加京东到家签名转大写!
This commit is contained in:
@@ -3,9 +3,8 @@ package fnpsapi
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -13,15 +12,41 @@ const (
|
||||
StoreExist = "该门店已存在"
|
||||
)
|
||||
|
||||
// 获取access_token
|
||||
func (a *API) GetAccessToken() (tokenInfo *TokenInfo, err error) {
|
||||
a.grantType = "authorization_code"
|
||||
a.signature = a.signParam2()
|
||||
result, err := a.AccessAPI(TokenURL, "", RequestPost, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := utils.Map2StructByJson(result["data"], &tokenInfo, false); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return tokenInfo, err
|
||||
}
|
||||
|
||||
// 创建门店.
|
||||
func (a *API) CreateStore(createStoreParam *CreateStoreParam) (err error) {
|
||||
func (a *API) CreateStore(createStoreParam *CreateStoreBaseInfo) (err error) {
|
||||
requestHead := a.MakeFnRequestHead()
|
||||
params := utils.Struct2FlatMap(createStoreParam)
|
||||
_, err = a.AccessAPI(ApiURL, "chainstoreCreate", RequestPost, params)
|
||||
requestHead["business_data"] = params
|
||||
_, err = a.AccessAPI(ApiURL, "chainstoreCreate", RequestPost, requestHead)
|
||||
return err
|
||||
}
|
||||
|
||||
// 更新门店
|
||||
func (a *API) UpdateStore(updateStore *UpdateStoreParam) (err error) {
|
||||
requestHead := a.MakeFnRequestHead()
|
||||
params := utils.Struct2FlatMap(updateStore)
|
||||
requestHead["business_data"] = params
|
||||
_, err = a.AccessAPI(ApiURL, "chainstoreUpdate", RequestPost, requestHead)
|
||||
return
|
||||
}
|
||||
|
||||
// 获取门店(单个)
|
||||
func (a *API) GetStore(storeID string) (getStoreResult *GetStoreResult, err error) {
|
||||
func (a *API) GetStore(storeID string) (getStoreResult *GetOneStoreRespData, err error) {
|
||||
params := GetOneStoreParam{
|
||||
BaseInfo: BaseInfo{
|
||||
AccessToken: a.accessToken,
|
||||
@@ -77,8 +102,4 @@ func IsErrShopExist(err error) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (a *API) UpdateStore(createStoreParam *CreateStoreParam) (err error) {
|
||||
//params := utils.Struct2FlatMap(createStoreParam)
|
||||
//_, err = a.AccessAPI("v2/chain_store/update", URL, params, true)
|
||||
return err
|
||||
}
|
||||
//todo商户门店接口,图片上传接口
|
||||
|
||||
Reference in New Issue
Block a user