Files
baseapi/platformapi/fnpsapi/store.go
苏尹岚 1c6a3e1479 s
2020-12-08 18:27:00 +08:00

50 lines
1.7 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package fnpsapi
import (
"git.rosy.net.cn/baseapi/utils"
)
type CreateStoreParam struct {
ChainStoreCode string `json:"chain_store_code,omitempty"`
ChainStoreName string `json:"chain_store_name,omitempty"`
ChainStoreType int `json:"chain_store_type,omitempty"`
MerchantCode string `json:"merchant_code,omitempty"`
ContactPhone string `json:"contact_phone,omitempty"`
Address string `json:"address,omitempty"`
PositionSource int `json:"position_source,omitempty"`
Longitude string `json:"longitude,omitempty"`
Latitude string `json:"latitude,omitempty"`
ServiceCode string `json:"service_code,omitempty"`
}
func (a *API) CreateStore(createStoreParam *CreateStoreParam) (err error) {
params := utils.Struct2FlatMap(createStoreParam)
_, err = a.AccessAPI("v2/chain_store", TestURL, params, true)
return err
}
type GetStoreResult struct {
ChainStoreCode string `json:"chain_store_code"`
ChainStoreName string `json:"chain_store_name"`
Address string `json:"address"`
Latitude string `json:"latitude"`
Longitude string `json:"longitude"`
PositionSource int `json:"position_source"`
City string `json:"city"`
ContactPhone string `json:"contact_phone"`
ServiceCode int `json:"service_code"`
Status int `json:"status"` //1关店2开店
}
func (a *API) GetStore(storeID int) (getStoreResult *GetStoreResult, err error) {
result, err := a.AccessAPI("v2/chain_store/query", TestURL, map[string]interface{}{
"chain_store_code": []string{utils.Int2Str(storeID)},
}, true)
if err == nil {
var results []*GetStoreResult
utils.Map2StructByJson(result["data"], results, false)
getStoreResult = results[0]
}
return getStoreResult, err
}