You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
meituan/api.order_list.go

64 lines
3.7 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package meituan
import (
"context"
"encoding/json"
"go.dtapp.net/gorequest"
"go.dtapp.net/gotime"
"net/http"
)
type ApiOrderListResponse struct {
DataList []struct {
Orderid string `json:"orderid"` // 订单id
Paytime string `json:"paytime"` // 订单支付时间10位时间戳
Payprice string `json:"payprice"` // 订单用户实际支付金额
Sid string `json:"sid"` // 订单对应的推广位sid
Smstitle string `json:"smstitle"` // 订单标题
Appkey string `json:"appkey"` // 订单对应的appkey外卖、话费、闪购、优选订单会返回该字段
Status int `json:"status"` // 订单状态,外卖、话费、闪购、优选、酒店订单会返回该字段 1 已付款 8 已完成 9 已退款或风控
Profit string `json:"profit"` // 订单预估返佣金额
CpaProfit string `json:"cpaProfit"` // 订单预估cpa总收益优选、话费券
Refundtime string `json:"refundtime"` // 订单退款时间10位时间戳外卖、话费、闪购、优选、酒店订单若发生退款会返回该字段(退款时间为最近的一次退款)
Refundprice string `json:"refundprice"` // 订单实际退款金额,外卖、话费、闪购、优选、酒店订单若发生退款会返回该字段
Refundprofit string `json:"refundprofit"` // 订单需要扣除的返佣金额,外卖、话费、闪购、优选、酒店订单若发生退款会返回该字段
CpaRefundProfit string `json:"cpaRefundProfit"` // 订单需要扣除的cpa返佣金额优选、话费券
Extra string `json:"extra"`
TradeTypeList []int `json:"tradeTypeList"` // 订单的奖励类型 3 首购奖励 5 留存奖励 2 cps 3 首购奖励
TradeTypeBusinessTypeMapStr string `json:"tradeTypeBusinessTypeMapStr"`
RiskOrder int `json:"riskOrder"` // 0表示非风控订单1表示风控订单
BusinessLine int `json:"businessLine"` // 业务线
SubBusinessLine int `json:"subBusinessLine"` // 子业务线
ActId int `json:"actId"` // 活动id可以在联盟活动列表中查看获取
} `json:"dataList"`
Total int `json:"total"` // 查询条件命中的总数据条数,用于计算分页参数
}
type ApiOrderListResult struct {
Result ApiOrderListResponse // 结果
Body []byte // 内容
Http gorequest.Response // 请求
Err error // 错误
}
func newApiOrderListResult(result ApiOrderListResponse, body []byte, http gorequest.Response, err error) *ApiOrderListResult {
return &ApiOrderListResult{Result: result, Body: body, Http: http, Err: err}
}
// ApiOrderList 订单列表查询接口(新版)
// https://union.meituan.com/v2/apiDetail?id=23
func (c *Client) ApiOrderList(ctx context.Context, notMustParams ...gorequest.Params) *ApiOrderListResult {
// 参数
params := gorequest.NewParamsWith(notMustParams...)
// 请求时刻10位时间戳(秒级)有效期60s
params["ts"] = gotime.Current().Timestamp()
params["appkey"] = c.GetAppKey()
params["sign"] = c.getSign(c.GetSecret(), params)
// 请求
request, err := c.request(ctx, apiUrl+"/api/orderList", params, http.MethodGet)
// 定义
var response ApiOrderListResponse
err = json.Unmarshal(request.ResponseBody, &response)
return newApiOrderListResult(response, request.ResponseBody, request, err)
}