变量初始化

This commit is contained in:
邹宗楠
2022-03-30 14:06:45 +08:00
parent afd25fe8a4
commit 3973a6a606
3 changed files with 28 additions and 89 deletions

View File

@@ -60,19 +60,6 @@ func (a *API) UpdateStore(updateStore *UpdateStoreParam) (err error) {
return
}
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 string `json:"service_code"`
Status int `json:"status"` //1关店2开店
}
func (a *API) GetStore(storeID string) (getStoreResult *GetStoreResult, err error) {
params := GetOneStoreParam{
BaseInfo: BaseInfo{
@@ -102,15 +89,15 @@ func (a *API) GetStore(storeID string) (getStoreResult *GetStoreResult, err erro
return nil, fmt.Errorf("%s", result["msg"])
}
fmt.Println("fn_getStoreDATA======", result["business_data"])
fnResult := &GetStoreResult{}
if storeData, ok := result["business_data"]; ok {
if err := json.Unmarshal([]byte(utils.Interface2String(storeData)), &getStoreResult); err != nil {
if err := json.Unmarshal([]byte(utils.Interface2String(storeData)), fnResult); err != nil {
return nil, err
}
} else {
err = fmt.Errorf(result["msg"].(string))
}
return getStoreResult, err
return fnResult, err
}
func IsErrShopNotExist(err error) bool {