Files
baseapi/platformapi/mtunionapi/order.go
2021-04-20 17:45:30 +08:00

81 lines
2.3 KiB
Go

package mtunionapi
import (
"git.rosy.net.cn/baseapi/utils"
"time"
)
const (
MtUnionOrderTypeTG = 0 //团购订单
MtUnionOrderTypeJD = 2 //酒店订单
MtUnionOrderTypeWM = 4 //外卖订单
MtUnionOrderTypeHF = 5 //话费订单
MtUnionOrderTypeSG = 6 //闪购订单
defaultPageSize = 50
)
type OrderListResult struct {
Total int `json:"total"`
DataList []struct {
Smstitle string `json:"smstitle"`
Refundprice string `json:"refundprice"`
Refundtime string `json:"refundtime"`
Orderid string `json:"orderid"`
Refundprofit string `json:"refundprofit"`
Paytime string `json:"paytime"`
Appkey string `json:"appkey"`
Payprice string `json:"payprice"`
Profit string `json:"profit"`
Sid string `json:"sid"`
Status int `json:"status"`
} `json:"dataList"`
}
func (a *API) OrderList(orderType int, startTime, endTime int64, page int) (orderListResult *OrderListResult, err error) {
result, err := a.AccessAPI2("api/orderList", false, map[string]interface{}{
"ts": time.Now().Unix(),
"type": orderType,
"startTime": startTime,
"endTime": endTime,
"page": page,
"limit": defaultPageSize,
})
if err == nil {
utils.Map2StructByJson(result, &orderListResult, false)
}
return orderListResult, err
}
type CouponListResult struct {
Total int `json:"total"`
DataList []struct {
AppKey string `json:"appKey"`
Sid string `json:"sid"`
CouponTime string `json:"couponTime"`
Money string `json:"money"`
MinUseMoney string `json:"minUseMoney"`
CouponName string `json:"couponName"`
CouponType string `json:"couponType"`
CouponCode string `json:"couponCode"`
BeginTime int `json:"beginTime"`
EndTime int `json:"endTime"`
} `json:"dataList"`
}
func (a *API) CouponList(orderType int, startTime, endTime int64, page int, sid string) (couponListResult *CouponListResult, err error) {
result, err := a.AccessAPI2("api/couponList", false, map[string]interface{}{
"ts": time.Now().Unix(),
"type": orderType,
"startTime": startTime,
"endTime": endTime,
"page": page,
"limit": defaultPageSize,
"sid": sid,
})
if err == nil {
utils.Map2StructByJson(result, &couponListResult, false)
}
return couponListResult, err
}