This commit is contained in:
邹宗楠
2022-11-21 18:44:03 +08:00
parent da310ce763
commit 20e99fa1f6
3 changed files with 105 additions and 54 deletions

View File

@@ -8,7 +8,7 @@ import (
type OrderGetSettleBillDetailV3Request struct {
doudian_sdk.BaseDoudianOpApiRequest
Param *OrderAddressModifyParam
Param *OrderGetSettleBillDetailV3Param
}
func (c *OrderGetSettleBillDetailV3Request) GetUrlPath() string {
@@ -17,7 +17,7 @@ func (c *OrderGetSettleBillDetailV3Request) GetUrlPath() string {
func New() *OrderGetSettleBillDetailV3Request {
request := &OrderGetSettleBillDetailV3Request{
Param: &OrderAddressModifyParam{},
Param: &OrderGetSettleBillDetailV3Param{},
}
request.SetConfig(doudian_sdk.GlobalConfig)
request.SetClient(doudian_sdk.DefaultDoudianOpApiClient)
@@ -40,11 +40,11 @@ func (c *OrderGetSettleBillDetailV3Request) GetParamObject() interface{} {
return c.Param
}
func (c *OrderGetSettleBillDetailV3Request) GetParams() *OrderAddressModifyParam {
func (c *OrderGetSettleBillDetailV3Request) GetParams() *OrderGetSettleBillDetailV3Param {
return c.Param
}
type OrderAddressModifyParam struct {
type OrderGetSettleBillDetailV3Param struct {
// 页数支持范围1~100
Size int64 `json:"size"`
// 查询开始时间格式为yyyy-MM-dd HH:mm:ss订单号未传的情况下开始时间必须传注意分页查询时除首次查询外应填入上一次返回的next_start_time

View File

@@ -8,49 +8,89 @@ type OrderGetSettleBillDetailV3Response struct {
doudian_sdk.BaseDoudianOpApiResponse
Data *OrderGetSettleBillDetailV3Data `json:"data"`
}
type DataItem struct {
// 结算时间
SettleTime string `json:"settle_time"`
// 结算单号
RequestNo string `json:"request_no"`
// 订单号
ShopOrderId string `json:"shop_order_id"`
// 子订单号
OrderId string `json:"order_id"`
// 商家实收(分)
SettleAmount int64 `json:"settle_amount"`
// 货款结算对应的账户类型: “聚合账户”“微信”“支付宝”“微信升级前”“合众支付”等
PayTypeDesc string `json:"pay_type_desc"`
// 结算单类型 0 :已结算 1 :结算后退款-原路退回 2 保证金退款-支出退回 3 结算后退款-非原路退回
TradeType int32 `json:"trade_type"`
// 是否包含结算前退款 0不包含 1包含
IsContainsRefundBeforeSettle int32 `json:"is_contains_refund_before_settle"`
// 下单时间
OrderTime string `json:"order_time"`
// 商品id
ProductId string `json:"product_id"`
// 商品数量
GoodsCount int32 `json:"goods_count"`
// 业务类型: 鲁班广告、值点商城、精选联盟、小店自卖等
FlowTypeDesc string `json:"flow_type_desc"`
// 订单类型:普通订单、尾款(尾款已支付)、尾款(已退款)、定金(已退款)、定金(尾款已支付)、定金(尾款未支付)
OrderType string `json:"order_type"`
// 订单总价(分)
TotalAmount int64 `json:"total_amount"`
// 商品总价(分)
TotalGoodsAmount int64 `json:"total_goods_amount"`
// 运费(分)
PostAmount int64 `json:"post_amount"`
// 店铺券(分)
ShopCoupon int64 `json:"shop_coupon"`
// 结算前退款金额(分) (结算前退货+运费-店铺券)
RefundBeforeSettle int64 `json:"refund_before_settle"`
// 平台补贴(分)
PlatformCoupon int64 `json:"platform_coupon"`
// 达人补贴(分)
AuthorCoupon int64 `json:"author_coupon"`
// 抖音支付补贴(分)
ZtPayPromotion int64 `json:"zt_pay_promotion"`
// DOU分期营销补贴
ZrPayPromotion int64 `json:"zr_pay_promotion"`
// 用户实付(分)
RealPayAmount int64 `json:"real_pay_amount"`
// 收入合计(分)
TotalIncome int64 `json:"total_income"`
// 平台服务费(分)
PlatformServiceFee int64 `json:"platform_service_fee"`
// 佣金(分)
Commission int64 `json:"commission"`
// 渠道分成(分)
GoodLearnChannelFee int64 `json:"good_learn_channel_fee"`
// 团长服务费(分)
ColonelServiceFee int64 `json:"colonel_service_fee"`
// 直播间站外推广(分)
ChannelPromotionFee int64 `json:"channel_promotion_fee"`
// 其他分成(学浪)(分)
OtherSharingAmount int64 `json:"other_sharing_amount"`
// 合计支出
TotalOutcome int64 `json:"total_outcome"`
// 备注
Remark string `json:"remark"`
// 打包费,单位:分
PackingAmount int64 `json:"packing_amount"`
}
type OrderGetSettleBillDetailV3Data struct {
Code string `json:"code"` // 返回code 100000为成功其他为失败
CodeMsg string `json:"code_msg"` // 返回信息描述,失败状态下会有失败描述
Data []DataList `json:"data"` // 订单流水明细列表
DataSize string `json:"data_size"` // 结果data的大小
IsEnd string `json:"is_end"` // 判断查询是否结束。0 未结束, 1 结束。未结束时需要把next_start_index作为下一次请求的start_index,next_start_time作为下一次请求的start_time
NextStartIndex string `json:"next_start_index"` // 下一次查询start_index
NextStartTime string `json:"next_start_time"` // 下一次查询start_time
Size string `json:"size"` // 请求的size
}
type DataList struct {
AuthorCoupon string `json:"author_coupon"` // 达人补贴(分)
ChannelPromotionFee string `json:"channel_promotion_fee"` // 直播间站外推广(分)
ColonelServiceFee string `json:"colonel_service_fee"` // 团长服务费(分)
Commission string `json:"commission"` // 佣金(分)
FlowTypeDesc string `json:"flow_type_desc"` // 业务类型: 鲁班广告、值点商城、精选联盟、小店自卖等
GoodLearnChannelFee string `json:"good_learn_channel_fee"` // 渠道分成(分)
GoodsCount string `json:"goods_count"` // 商品数量
IsContainsRefundBeforeSettle string `json:"is_contains_refund_before_settle"` // 是否包含结算前退款 0不包含 1包含
OrderId string `json:"order_id"` // 子订单号
OrderTime string `json:"order_time"` // 下单时间
OrderType string `json:"order_type"` // 订单类型:普通订单、尾款(尾款已支付)、尾款(已退款)、定金(已退款)、定金(尾款已支付)、定金(尾款未支付)
OtherSharingAmount string `json:"other_sharing_amount"` // 其他分成(学浪)(分)
PackingAmount string `json:"packing_amount"` // 打包费,单位:分
PayTypeDesc string `json:"pay_type_desc"` // 货款结算对应的账户类型: “聚合账户”“微信”“支付宝”“微信升级前”“合众支付”等
PlatformCoupon string `json:"platform_coupon"` // 平台补贴(分)
PlatformServiceFee string `json:"platform_service_fee"` // 平台服务费(分)
PostAmount string `json:"post_amount"` // 运费(分)
ProductId string `json:"product_id"` // 商品id
RealPayAmount string `json:"real_pay_amount"` // 用户实付(分)
RefundBeforeSettle string `json:"refund_before_settle"` // 结算前退款金额(分) (结算前退货+运费-店铺券)
Remark string `json:"remark"` // 备注
RequestNo string `json:"request_no"` // 结算单号
SettleAmount string `json:"settle_amount"` // 商家实收(分)
SettleTime string `json:"settle_time"` // 结算时间
ShopCoupon string `json:"shop_coupon"` // 店铺券(分)
ShopOrderId string `json:"shop_order_id"` // 订单号
TotalAmount string `json:"total_amount"` // 订单总价(分)
TotalGoodsAmount string `json:"total_goods_amount"` // 商品总价(分)
TotalIncome string `json:"total_income"` // 收入合计(分)
TotalOutcome string `json:"total_outcome"` // 合计支出
TradeType string `json:"trade_type"` // 结算单类型 0 :已结算 1 :结算后退款-原路退回 2 保证金退款-支出退回 3 结算后退款-非原路退回
ZrPayPromotion string `json:"zr_pay_promotion"` // DOU分期营销补贴
ZtPayPromotion string `json:"zt_pay_promotion"` // 抖音支付补贴(分)
// 返回code 100000为成功其他为失败
Code string `json:"code"`
// 返回信息描述,失败状态下会有失败描述
CodeMsg string `json:"code_msg"`
// 订单流水明细列表
Data []DataItem `json:"data"`
// 请求的size
Size int64 `json:"size"`
// 下一次查询start_index
NextStartIndex string `json:"next_start_index"`
// 下一次查询start_time
NextStartTime string `json:"next_start_time"`
// 判断查询是否结束。0 未结束, 1 结束。未结束时需要把next_start_index作为下一次请求的start_index,next_start_time作为下一次请求的start_time
IsEnd int32 `json:"is_end"`
// 结果data的大小
DataSize int64 `json:"data_size"`
}

View File

@@ -1,22 +1,33 @@
package tiktok_api
import (
"errors"
order_getSettleBillDetailV3_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_getSettleBillDetailV3/request"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/globals"
)
// GetSettleBillDetailV3 商家结算账单
// 已结算的订单才会有数据数据T+1生成建议第二天15点之后查询。如因任务积压导致延迟的情况建议重试。
// 1、推荐使用start_index方式查询
func (a *API) GetSettleBillDetailV3(param *order_getSettleBillDetailV3_request.OrderAddressModifyParam) {
func (a *API) GetSettleBillDetailV3(param *order_getSettleBillDetailV3_request.OrderGetSettleBillDetailV3Param) (map[string]int64, string, error) {
request := order_getSettleBillDetailV3_request.New()
request.Param = param
result, err := request.Execute(a.accessTokenObj)
if err != nil {
return
return nil, "", err
}
globals.SugarLogger.Debugf("======:%s", utils.Format4Output(result, false))
globals.SugarLogger.Debugf("======:%s", err)
if result.Code != RequestSuccessCode {
return nil, "", errors.New(result.SubMsg)
}
if len(result.Data.Data) == 0 {
return nil, "", nil
}
totalShopMoney := make(map[string]int64, 0)
for _, v := range result.Data.Data {
totalShopMoney[v.ShopOrderId] = v.SettleAmount
}
return totalShopMoney, result.Data.NextStartIndex, nil
}