1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package upstream
import (
"errors"
)
type AliMsgType string
type AliRefundStatus string
const (
//产品下架
AliProductExpire AliMsgType = "PRODUCT_RELATION_VIEW_PRODUCT_EXPIRE"
// 产品删除
AliProductExpire2 AliMsgType = "PRODUCT_RELATION_VIEW_PRODUCT_DELETE"
// 产品审核下架
AliProductExpire3 AliMsgType = "PRODUCT_RELATION_VIEW_PRODUCT_AUDIT"
// 产品新增或修改
AliProductModify AliMsgType = "PRODUCT_RELATION_VIEW_PRODUCT_NEW_OR_MODIFY"
// 产品上架
AliProductRepost AliMsgType = "PRODUCT_RELATION_VIEW_PRODUCT_REPOST"
// 商品池&超买价变更消息
AliProductPrice AliMsgType = "PRODUCT_RELATION_VIEW_EXIT_SUPERBUYER"
// 订单发货
AliOrderSendGoods AliMsgType = "ORDER_BUYER_VIEW_ANNOUNCE_SENDGOODS"
// 订单确认收货
AliOrderComfirm AliMsgType = "ORDER_BUYER_VIEW_ORDER_COMFIRM_RECEIVEGOODS"
// 售中退款
AliOrderRefund AliMsgType = "ORDER_BUYER_VIEW_ORDER_BUYER_REFUND_IN_SALES"
// 售后退款
AliOrderRefund2 AliMsgType = "ORDER_BUYER_VIEW_ORDER_REFUND_AFTER_SALES"
// AliAfterSaleStateAgree AliAfterSaleStateAgree
AliAfterSaleStateAgree AliRefundStatus = "SELLER_AGREE_REFUND_PROCOTOL"
// AliAfterSaleStateAgree2 AliAfterSaleStateAgree2
AliAfterSaleStateAgree2 AliRefundStatus = "SYSTEM_AGREE_REFUND_PROTOCOL"
// AliAfterSaleStateRefuse AliAfterSaleStateRefuse
AliAfterSaleStateRefuse AliRefundStatus = "SELLER_REJECT_REFUND"
// AliAfterSaleStateRefuse2 AliAfterSaleStateRefuse2
AliAfterSaleStateRefuse2 AliRefundStatus = "SELLER_REJECT_REFUND_PROCOTOL"
// AliAfterSaleStateSuccess AliAfterSaleStateSuccess
AliAfterSaleStateSuccess AliRefundStatus = "SELLER_AGREE_REFUND"
// AliAfterSaleStateSuccess2 AliAfterSaleStateSuccess2
AliAfterSaleStateSuccess2 AliRefundStatus = "SYSTEM_AGREE_REFUND"
)
// ToType ToType
func (c AliMsgType) ToType() (int, error) {
switch c {
case AliProductExpire, AliProductExpire2,AliProductExpire3:
return ProductExpire, nil
case AliProductModify:
return ProductModify, nil
case AliProductRepost:
return ProductRepost, nil
case AliProductPrice:
return ProductPrice, nil
case AliOrderSendGoods:
return OrderSendgoods, nil
case AliOrderComfirm:
return OrderComfirmReceiveGoods, nil
case AliOrderRefund, AliOrderRefund2:
return RefundApply, nil
default:
return 0, errors.New("not allow type")
}
}
// ToStatus ToStatus
func (c AliRefundStatus) ToStatus() (int, error) {
switch c {
case AliAfterSaleStateAgree, AliAfterSaleStateAgree2:
return RefundAgree, nil
case AliAfterSaleStateRefuse, AliAfterSaleStateRefuse2:
return RefundRefuse, nil
case AliAfterSaleStateSuccess, AliAfterSaleStateSuccess2:
return RefundSuccess, nil
default:
return 0, errors.New("not allow type")
}
}
//"refundsuccess" == Sockedata.Data.CurrentStatus && Sockedata.Data.RefundAction == "SYSTEM_AGREE_REFUND_PROTOCOL"
// IsSuccess IsSuccess
func (c AliRefundStatus) IsSuccess() bool {
return c == AliAfterSaleStateSuccess || c == AliAfterSaleStateSuccess2 || c == AliAfterSaleStateAgree2
}