This commit is contained in:
邹宗楠
2023-04-25 16:31:08 +08:00
parent 98a74e5379
commit f9ee68cef3
3 changed files with 64 additions and 9 deletions

View File

@@ -4,6 +4,12 @@ import (
"git.rosy.net.cn/baseapi/utils"
)
const (
BillChargeTypeOrder = 1 // 外卖订单
BillChargeTypeWayBillFee = 3 // 配送费
BillChargeTypeTimingFee = 10 // 定时宝,保险费
)
type Bill struct {
AppPoiCode string `json:"app_poi_code"` // APP方门店id传商家中台系统里门店的编码。如商家在操作绑定门店至开放平台应用中时未绑定三方门店id信息则默认APP方门店id与美团门店id相同。
StartDate int64 `json:"start_date"` // 秒级时间戳
@@ -49,8 +55,8 @@ type StoreBillListReq struct {
// StoreBillListRes 门店结算返回值
type StoreBillListRes struct {
ExtraInfo ExtraInfoData `json:"extra_info"`
Data []*BillListData `json:"data"`
ExtraInfo ExtraInfoData `json:"extra_info"`
Data []BillListData `json:"data"`
}
type ExtraInfoData struct {

View File

@@ -3,14 +3,15 @@ package mtwmapi
import (
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/globals"
"sort"
"testing"
"time"
)
func TestBillList(t *testing.T) {
now := time.Now()
from := time.Date(now.Year(), now.Month(), now.Day()-5, 0, 0, 0, 0, time.Local)
to := time.Date(now.Year(), now.Month(), now.Day()-5, 23, 59, 59, 59, time.Local)
from := time.Date(now.Year(), now.Month(), now.Day()-8, 0, 0, 0, 0, time.Local)
to := time.Date(now.Year(), now.Month(), now.Day()-2, 23, 59, 59, 59, time.Local)
param := &Bill{
AppPoiCode: "16967920",
StartDate: from.Unix(),
@@ -19,8 +20,56 @@ func TestBillList(t *testing.T) {
Limit: 200,
}
data, _ := api.GetStoreBillList(param)
globals.SugarLogger.Debugf("data := %s", utils.Format4Output(data.Data[0], false))
// performanceServiceFee 订单配送费
// userPayShippingAmount 用户支付配送费
data, err := api.GetStoreBillList(param)
if err != nil {
globals.SugarLogger.Debugf("err := %v", err)
return
}
var reallyData = make([]BillListData, 0)
for _, v := range data.Data {
if v.WmOrderViewId != "" {
reallyData = append(reallyData, v)
}
}
sort.Slice(reallyData, func(i, j int) bool {
return utils.Str2Int64(reallyData[i].WmOrderViewId) < utils.Str2Int64(reallyData[j].WmOrderViewId)
})
for _, v := range reallyData {
globals.SugarLogger.Debugf("OrderId := %s,TimingFee:%d, DeliveryFee : %s, PlatformSettlement : %d", v.WmOrderViewId, v.BillChargeType, v.ChargeFeeDesc, v.SettleAmount)
}
//orderSettle := make(map[string]*SettleOrderList, 0)
//for _, v := range data.Data {
// settle, ok := orderSettle[v.WmOrderViewId]
// if !ok {
// settle = &SettleOrderList{OrderId: v.WmOrderViewId}
// }
// if settle.OrderId == "" {
// settle.OrderId = v.WmOrderViewId
// }
// switch v.BillChargeType {
// case BillChargeTypeOrder:
// settle.PlatformSettlement = v.SettleAmount
// case BillChargeTypeWayBillFee:
// settle.DeliveryFee = v.SettleAmount
// case BillChargeTypeTimingFee:
// settle.TimingFee = v.SettleAmount
// default:
// continue
// }
// orderSettle[v.WmOrderViewId] = settle
//}
//for _, v := range orderSettle {
// //globals.SugarLogger.Debugf("%s:%s", v.OrderId, utils.Format4Output(v, false))
// globals.SugarLogger.Debugf("OrderId := %s,TimingFee:%d, DeliveryFee : %d, PlatformSettlement : %d", v.OrderId, v.TimingFee, v.DeliveryFee, v.PlatformSettlement)
//}
}
type SettleOrderList struct {
OrderId string `json:"order_id"` // 订单id
TimingFee int64 `json:"timing_fee"` // 准时保险费
DeliveryFee int64 `json:"delivery_fee"` // 配送费
PlatformSettlement int64 `json:"platform_settlement"` // 平台结算金额
}

View File

@@ -23,7 +23,7 @@ func init() {
api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
// 果园
// api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
//商超
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_n4TwqCntWWuvQwAawzxC0w") //token_n4TwqCntWWuvQwAawzxC0w