package ebaiapi import ( "git.rosy.net.cn/baseapi/utils" ) type ShopInfo struct { ShopID int `json:"shop_id"` BaiduShopID int `json:"baidu_shop_id"` Name string `json:"name"` Status int `json:"status"` SysStatus int `json:"sys_status"` OrderPush int `json:"order_push"` OrderStatusPush int `json:"order_status_push"` } func (a *API) ShopList(orderPush, orderStatusPush, status, sysStatus int) (shopList []*ShopInfo, err error) { body := map[string]interface{}{} if orderPush >= 0 { body["order_push"] = orderPush } if orderStatusPush >= 0 { body["order_status_push"] = orderStatusPush } if status >= 0 { body["status"] = status } if sysStatus >= 0 { body["sys_status"] = sysStatus } result, err := a.AccessAPI("shop.list", body) if err == nil { list := result.Data.([]interface{}) shopList = make([]*ShopInfo, len(list)) for k, v := range list { mapData := v.(map[string]interface{}) shopList[k] = &ShopInfo{ ShopID: int(utils.MustInterface2Int64(mapData["shop_id"])), BaiduShopID: int(utils.MustInterface2Int64(mapData["baidu_shop_id"])), } } return shopList, nil } return nil, err }