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.
go-library/service/meituan/api.orderList.go

66 lines
4.1 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"
"github.com/dtapps/go-library/utils/gojson"
"github.com/dtapps/go-library/utils/gorequest"
"github.com/dtapps/go-library/utils/gotime"
"net/http"
)
type ApiOrderListResponse struct {
DataList []struct {
ActId int `json:"actId,omitempty"` // 活动id可以在联盟活动列表中查看获取
BusinessLine int `json:"businessLine,omitempty"` // 业务线
SubBusinessLine int `json:"subBusinessLine,omitempty"` // 子业务线
Orderid string `json:"orderid,omitempty"` // 订单id
Paytime string `json:"paytime,omitempty"` // 订单支付时间10位时间戳
Payprice string `json:"payprice,omitempty"` // 订单用户实际支付金额
Profit string `json:"profit,omitempty"` // 订单预估返佣金额
CpaProfit string `json:"cpaProfit,omitempty"` // 订单预估cpa总收益优选、话费券
Sid string `json:"sid,omitempty"` // 订单对应的推广位sid
Appkey string `json:"appkey,omitempty"` // 订单对应的appkey外卖、话费、闪购、优选订单会返回该字段
Smstitle string `json:"smstitle,omitempty"` // 订单标题
ProductId string `json:"productId,omitempty"` // 商品ID
ProductName string `json:"productName,omitempty"` // 商品名称
Refundprice string `json:"refundprice,omitempty"` // 订单实际退款金额,外卖、话费、闪购、优选、酒店订单若发生退款会返回该字段
Refundtime string `json:"refundtime,omitempty"` // 订单退款时间10位时间戳外卖、话费、闪购、优选、酒店订单若发生退款会返回该字段(退款时间为最近的一次退款)
Refundprofit string `json:"refundprofit,omitempty"` // 订单需要扣除的返佣金额,外卖、话费、闪购、优选、酒店订单若发生退款会返回该字段
CpaRefundProfit string `json:"cpaRefundProfit,omitempty"` // 订单需要扣除的cpa返佣金额优选、话费券
Status int `json:"status,omitempty"` // 订单状态,外卖、话费、闪购、优选、酒店订单会返回该字段 1 已付款 8 已完成 9 已退款或风控
TradeTypeList []int `json:"tradeTypeList,omitempty"` // 订单的奖励类型 3 首购奖励 5 留存奖励 2 cps 3 首购奖励
RiskOrder int `json:"riskOrder,omitempty"` // 0表示非风控订单1表示风控订单
Extra string `json:"extra,omitempty"`
TradeTypeBusinessTypeMapStr string `json:"tradeTypeBusinessTypeMapStr,omitempty"`
} `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 = gojson.Unmarshal(request.ResponseBody, &response)
return newApiOrderListResult(response, request.ResponseBody, request, err)
}