ejy
This commit is contained in:
@@ -137,3 +137,43 @@ func (a *API) GetStationList() (getStationListResult []*GetStationListResult, er
|
||||
}
|
||||
return getStationListResult, err
|
||||
}
|
||||
|
||||
type GetUserOrdersResult struct {
|
||||
ConsumeTimes string `json:"consumeTimes"`
|
||||
AllPaysum string `json:"allPaysum"`
|
||||
SaveMoney string `json:"saveMoney"`
|
||||
OrderList []struct {
|
||||
Orderld string `json:"orderld"`
|
||||
StationName string `json:"stationName"`
|
||||
StationPic string `json:"stationPic"`
|
||||
PayTime string `json:"payTime"`
|
||||
Ordersum string `json:"ordersum"`
|
||||
Reducesum string `json:"reducesum"`
|
||||
Orderstate int `json:"orderstate"`
|
||||
HasstationPhone int `json:"hasstationPhone"`
|
||||
StationPhone string `json:"stationPhone"`
|
||||
} `json:"orderList"`
|
||||
OrderQuantity int `json:"orderQuantity"`
|
||||
CurrentPageNum int `json:"currentPageNum"`
|
||||
AllPageNum int `json:"allPageNum"`
|
||||
PersonalInfo struct {
|
||||
JoinEjiayouDay string `json:"joinEjiayouDay"`
|
||||
Headurl string `json:"headurl"`
|
||||
NickName string `json:"nickName"`
|
||||
CenterPicURL string `json:"centerPicUrl"`
|
||||
GlobalPicURL string `json:"globalPicUrl"`
|
||||
} `json:"personalInfo"`
|
||||
}
|
||||
|
||||
//获取用户个人订单
|
||||
func (a *API) GetUserOrders(userPhone string, page int) (getUserOrdersResult *GetUserOrdersResult, err error) {
|
||||
params := make(map[string]interface{})
|
||||
params["stationIds"] = ""
|
||||
params["page"] = page
|
||||
sign := a.signParam(params)
|
||||
result, err := a.AccessAPI("oreo/ejiayou_open_api/orders/histroy/"+userPhone+"/"+a.platformName+"/"+sign+"/"+utils.Int64ToStr(a.timeStamp), Url, params, true)
|
||||
if err == nil {
|
||||
utils.Map2StructByJson(result["data"], &getUserOrdersResult, false)
|
||||
}
|
||||
return getUserOrdersResult, err
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ func init() {
|
||||
logger, _ := zap.NewDevelopment()
|
||||
sugarLogger = logger.Sugar()
|
||||
baseapi.Init(sugarLogger)
|
||||
// api = New("1Zbve", "ymsrrxlZXlmglK6Q", "MYsFZGgwwprIahzQ")
|
||||
api = New("1Zbve", "htvse3XEDhBnCTNo", "QM5RnGl6kNh3ENLT")
|
||||
api.SetTimestamp(time.Now().Unix())
|
||||
}
|
||||
@@ -29,3 +30,11 @@ func TestGetStationList(t *testing.T) {
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestGetUserOrders(t *testing.T) {
|
||||
result, err := api.GetUserOrders("18980410281", 1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user