This commit is contained in:
邹宗楠
2024-08-01 15:21:32 +08:00
parent 757573973f
commit 3d5ac6505c
5 changed files with 88 additions and 6 deletions

View File

@@ -12,7 +12,7 @@ import (
const (
CmdOrderCreate = "order.create"
CmdOrderDeliveryStatus = "order.deliveryStatus.push"
CmdOrderPartRefund = "order.partrefund.push" // 售前只能是商户发起 售后是用户, 你看是由谁发起的就可以知道,来自惠焕(部分退款)
CmdOrderPartRefund = "order.partrefund.push" // 售前只能是商户发起 售后是用户, 你看是由谁发起的就可以知道,来自惠焕(部分退款,饿百废弃了)
CmdOrderReversePush = "order.reverse.push" // 订单逆向消息推送
CmdOrderStatus = "order.status.push"
CmdOrderUserCancel = "order.user.cancel"
@@ -80,6 +80,28 @@ type CBPartRefundInfo struct {
RefundPrice int64 `json:"refund_price"`
}
type CBOrderReversePush struct {
EventId string `json:"event_id"` // 操作事件全局唯一事件
PlatformShopId int `json:"platform_shop_id"` // 平台门店ID
OrderId string `json:"order_id"` // 订单ID
RefundOrderId int64 `json:"refund_order_id"` // 逆向单号
CurReverseEvent struct {
EventId string `json:"event_id"` // 操作事件全局唯一事件
ImageList []string `json:"image_list"` // 操作凭证列表
LastRefundStatus int `json:"last_refund_status"` // 逆向单操作前的退货状态0-无效状态1001-买家已申请退货等待审批处理1002-商家拒绝退货申请1003-退货仲裁已发起客服介入中1004-已同意退货等待发货1005-已发货等待卖家确认收货1006-已收到货,并同意退款, 1007-未收到货不同意退款1008-退货关闭
LastReturnGoodsStatus int `json:"last_return_goods_status"` // 逆向单操作前的逆向单状态0-初始化10-申请20-拒绝30-仲裁40-关闭50-成功60-失败
OccurTime int64 `json:"occur_time"` // 逆向单操作事件发生时间 单位:毫秒
OperatorRole int `json:"operator_role"` // 逆向单操作者角色10 用户 ,20商户,30客服 ,25 API商家代客发起,40系统
OrderId string `json:"order_id"` // 订单ID
ReasonCode int `json:"reason_code"` // 逆向单操作原因对应code具体原因枚举详见文档https://open-retail.ele.me/#/guide?topic=ntmt8f
ReasonContent string `json:"reason_content"` // 逆向单操作原因备注内容
RefundOrderId int64 `json:"refund_order_id"` // 逆向单号
RefundReasonDesc string `json:"refund_reason_desc"` // 逆向单操作原因code对应的文案
RefundStatus int `json:"refund_status"` // 即当前的逆向单状态0-初始化10-申请20-拒绝30-仲裁40-关闭50-成功60-失败
ReturnGoodsStatus int `json:"return_goods_status"` // 即当前的退货状态0-无效状态1001-买家已申请退货等待审批处理1002-商家拒绝退货申请1003-退货仲裁已发起客服介入中1004-已同意退货等待发货1005-已发货等待卖家确认收货1006-已收到货,并同意退款, 1007-未收到货不同意退款1008-退货关闭
} `json:"cur_reverse_event"` // 逆向单当前操作信息
}
type CBUserCancelInfo struct {
OrderID int64 `json:"order_id"`
CancelReason string `json:"cancel_reason"`
@@ -226,6 +248,9 @@ func (a *API) GetCallbackMsg(request *http.Request) (msg *CallbackMsg, callbackR
tmpObj = &ImMessageSend{}
case CmdImMessageReadEvent:
tmpObj = &ImMessageRead{}
case CmdOrderReversePush:
var reversePush CBOrderReversePush
tmpObj = &reversePush
}
if tmpObj != nil {
if utils.Map2StructByJson(msg.Body, tmpObj, true) == nil {

View File

@@ -58,16 +58,32 @@ const (
)
const (
// 订单下行 - order.partrefund.push-部分退款订单信息推送
// 订单下行 - order.partrefund.push-部分退款订单信息推送(老版本)
OrderPartRefuncTypeMerchant = 1 // 表示商户发起的部分退款
OrderPartRefuncTypeCustomer = 2 // 表示用户发起的部分退款
OrderPartRefuncTypeCS = 3 // 表示客服直接发起的部分退款
// 订单下行 - order.reverse.push-部分退款订单信息推送(新版本)
OrderReverseRefuncTypeCustomer = 10 // 表示用户发起的部分退款
OrderReverseRefuncTypeMerchant = 20 // 表示商户发起的部分退款
OrderReverseRefuncTypeCS = 30 // 表示客服直接发起的部分退款
OrderReverseRefuncTypeAPI = 25 // 表示api商家直接发起的部分退款
OrderReverseRefuncTypeSys = 40 // 系统自动发起
// 老版本消息通知(售后单子)
OrderPartRefundApply = 10 // 表示商家/用户发起部分退款申请
OrderPartRefundSuccess = 20 // 表示部分退款成功
OrderPartRefundUserApplyArbitration = 30 // 用户申请仲裁,客服介入
OrderPartRefundFailed = 40 // 表示部分退款失败
OrderPartRefundMerchantRefused = 50 // 表示商家拒绝用户发起的部分退款申请
// 新版本的消息通知(售后单子)
OrderReversePushApplyInit = 0 // 初始化
OrderReversePushApply = 10 // 申请
OrderReversePushApplyRefuse = 20 // 拒绝
OrderReversePushApplyArbitration = 30 // 仲裁
OrderReversePushApplyClose = 40 // 关闭
OrderReversePushApplySuccess = 50 // 成功
OrderReversePushApplyFail = 60 // 失败
// 订单下行 - order.user.cancel-用户申请订单取消/退款
OrderUserCancelApply = 10 // 发起申请

View File

@@ -316,3 +316,37 @@ type RiderLocation struct {
Latitude string `json:"latitude"` // 纬度,建议使用高德坐标 39.90038
Longitude string `json:"longitude"` // 经度,建议使用高德坐标 116.389149
}
// ReverseSkuList 售后单信息详情获取
type ReverseSkuList struct {
ApplyQuantity int `json:"apply_quantity"` // 申请数量
ApplyRefundTime int64 `json:"apply_refund_time"` // 申请时间
ApplyRefundUserAmount int `json:"apply_refund_user_amount"` // 子订单用户申请金额
CommodityType int `json:"commodity_type"` // 商品子单类型, 1:称重品、2:标品、3:按件称重、4:虚拟商品子单
CustomSkuId string `json:"custom_sku_id"` // 商品自定义id
CustomSkuSpecId string `json:"custom_sku_spec_id"` // 商品多规格自定义id
FreeGift bool `json:"free_gift"` // 是否是赠品子单true 是, false 否
FundCalculateType int `json:"fund_calculate_type"` // 商品子单 退款算价类型 枚举值0按件数退1按照金额退
GiftRelatedSubBizOrderIdList []interface{} `json:"gift_related_sub_biz_order_id_list"` // 赠品子单关联的主品子单Id列表 free_gift = true 时,有效)
IsCombine bool `json:"is_combine"` // 是否为组合品
LastRefundStatus int `json:"last_refund_status"` // 该退单的上一个退款状态0初始化10申请20拒绝30仲裁40关闭50成功60失败
PlatformSkuId int64 `json:"platform_sku_id"` // 饿了么商品ID
RefundOrderId int64 `json:"refund_order_id"` // 零售退款单ID
RefundQuantity int `json:"refund_quantity"` // 商家同意件数,件数单位:整型
RefundStatus int `json:"refund_status"` // 商品子单本次退款状态枚举值10 申请20 拒绝30 仲裁40 关闭50 成功60 失败
RefundUserAmount int `json:"refund_user_amount"` // 该逆向单实际退款给用户的金额,单位分
RefundWeight int `json:"refund_weight"` // 商品子单退款额重量信息, 单位g
SkuName string `json:"sku_name"` // sku 商品名称
SkuSpecId string `json:"sku_spec_id"` // 多规格商品id
SubBizOrderId string `json:"sub_biz_order_id"` // 商品子单唯一标识
Upc string `json:"upc"` // upc
VirtualType string `json:"virtual_type"` // 0:普通实物商品 1:包装费子单 2:处方服务费子单、3:附加0.01费子单、4:配送费子单
DiscountDetail struct {
AgentDiscountAmount int `json:"agent_discount_amount"` // 本次退款总金额中 包含的【代理商】承担金额,单位:分
DiscountTotalAmount int `json:"discount_total_amount"` // 本次退款总金额中的补贴总额,单位:分
MerchantDiscountAmount int `json:"merchant_discount_amount"` // 本次退款总金额中 包含的【商家】承担金额,单位:分
PlatformDiscountAmount int `json:"platform_discount_amount"` // 本次退款总金额中 包含的【平台】承担金额,单位:分
TotalPrice int `json:"total_price"` // 商品原总价 = (用户实付 + 补贴总额 discount_total_amount
UserDiscountAmount int `json:"user_discount_amount"` // 本次退款总金额中 包含的【用户】承担金额,单位:分
} `json:"discount_detail"` // 商品子单的退款分摊明细详情
}

View File

@@ -1,6 +1,7 @@
package ebaiapi
import (
"encoding/json"
"fmt"
"git.rosy.net.cn/jx-callback/globals"
"strings"
@@ -88,12 +89,18 @@ func Test11111(t *testing.T) {
}
func TestGetReverseOrder(t *testing.T) {
date, isAll, err := api.GetReverseOrder("4037190131865481753")
date, isAll, err := api.GetReverseOrder("4031960081244121804")
fmt.Println(isAll)
fmt.Println(err)
for _, v := range date {
fmt.Println(v)
refundSkuList := make([]*ReverseSkuList, 0, len(date))
refundByte, _ := json.Marshal(date)
if err = json.Unmarshal(refundByte, &refundSkuList); err != nil {
fmt.Println(err)
return
}
globals.SugarLogger.Debugf("refundSkuList := %s", utils.Format4Output(refundSkuList, false))
}
func TestOrderGet2(t *testing.T) {
result, err := api.OrderGet2("601124101999169939")

View File

@@ -7,7 +7,7 @@ import (
)
func TestCommentQuery(t *testing.T) {
result, err := api.CommentQuery("18477421", "20240712", "20240717", 0, 0, CommentReplyStatusAll)
result, err := api.CommentQuery("7821254", "20240730", "20240731", 0, 0, CommentReplyStatusAll)
if err != nil {
t.Fatal(err)
}