callbacks

package
v1.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbackExtraInfoInterface added in v1.0.3

type CallbackExtraInfoInterface interface {
	GetMessageType() string
	GetEventType() string
	GetTypeKey() string
	ParseFromJson(data []byte) (CallbackExtraInfoInterface, error)
}

type CallbackHandler added in v1.0.3

type CallbackHandler struct {
	// contains filtered or unexported fields
}

func NewCallbackHandler

func NewCallbackHandler(token string, encodingAESKey string) (*CallbackHandler, error)

func (*CallbackHandler) EchoTestHandler added in v1.0.3

func (cb *CallbackHandler) EchoTestHandler(rw http.ResponseWriter, r *http.Request)

后台回调配置URL,申请校验

func (*CallbackHandler) GetCallbackMsg added in v1.0.3

func (cb *CallbackHandler) GetCallbackMsg(r *http.Request) (CallbackMessage, error)

解析并获取回调数据

type CallbackMessage

type CallbackMessage struct {
	// ToUserName 接收成员
	ToUserName string `json:"ToUserName"`
	// FromUserName 发送成员
	FromUserName string `json:"FromUserName"`
	// CreateTime 消息创建时间,秒级时间戳
	CreateTime int64 `json:"CreateTime"`
	// MsgType 消息类型
	MsgType MessageType `json:"MsgType"`
	// MsgID 消息id,64位整型
	MsgID int64 `json:"MsgId"`
	// EventType 事件类型 MsgType为event存在
	EventType EventType `json:"Event"`

	// 额外的信息
	Extras CallbackExtraInfoInterface `json:"-"`

	// 原始回调内容,方便排查问题
	OriginalMessage string `json:"OriginalMessage"`
}

CallbackMessage 一条接收到的消息

func (CallbackMessage) GetStructName

func (m CallbackMessage) GetStructName() string

func (CallbackMessage) GetTypeKey

func (m CallbackMessage) GetTypeKey() string

func (CallbackMessage) ParseMessageFromJson

func (m CallbackMessage) ParseMessageFromJson(body []byte) (CallbackMessage, error)

type ChannelsEcAcctNotify added in v1.0.0

type ChannelsEcAcctNotify struct {
	CreateTime  int    `json:"CreateTime"`
	Event       string `json:"Event"`
	MsgType     string `json:"MsgType"`
	ToUserName  string `json:"ToUserName"`
	AccountInfo struct {
		Event int `json:"event"`
	} `json:"account_info"`
}

func (ChannelsEcAcctNotify) GetEventType added in v1.0.0

func (ChannelsEcAcctNotify) GetEventType() string

func (ChannelsEcAcctNotify) GetMessageType added in v1.0.0

func (ChannelsEcAcctNotify) GetMessageType() string

func (ChannelsEcAcctNotify) GetTypeKey added in v1.0.0

func (m ChannelsEcAcctNotify) GetTypeKey() string

func (ChannelsEcAcctNotify) ParseFromJson added in v1.0.0

func (ChannelsEcAcctNotify) ParseFromJson(data []byte) (CallbackExtraInfoInterface, error)

type ChannelsEcAftersaleUpdate added in v1.0.0

type ChannelsEcAftersaleUpdate struct {
	CreateTime                      int    `json:"CreateTime"`
	Event                           string `json:"Event"`
	FromUserName                    string `json:"FromUserName"`
	MsgType                         string `json:"MsgType"`
	ToUserName                      string `json:"ToUserName"`
	FinderShopAftersaleStatusUpdate struct {
		AfterSaleOrderID string `json:"after_sale_order_id"`
		OrderID          string `json:"order_id"`
		Status           string `json:"status"`
	} `json:"finder_shop_aftersale_status_update"`
}

func (ChannelsEcAftersaleUpdate) GetEventType added in v1.0.0

func (ChannelsEcAftersaleUpdate) GetEventType() string

func (ChannelsEcAftersaleUpdate) GetMessageType added in v1.0.0

func (ChannelsEcAftersaleUpdate) GetMessageType() string

func (ChannelsEcAftersaleUpdate) GetTypeKey added in v1.0.0

func (m ChannelsEcAftersaleUpdate) GetTypeKey() string

func (ChannelsEcAftersaleUpdate) ParseFromJson added in v1.0.0

type ChannelsEcBrand added in v1.0.0

type ChannelsEcBrand struct {
	BrandEvent struct {
		AuditID string `json:"audit_id"`
		BrandID string `json:"brand_id"`
		Reason  string `json:"reason"`
		Status  int    `json:"status"`
	} `json:"BrandEvent"`
	CreateTime   int    `json:"CreateTime"`
	Event        string `json:"Event"`
	FromUserName string `json:"FromUserName"`
	MsgType      string `json:"MsgType"`
	ToUserName   string `json:"ToUserName"`
}

func (ChannelsEcBrand) GetEventType added in v1.0.0

func (ChannelsEcBrand) GetEventType() string

func (ChannelsEcBrand) GetMessageType added in v1.0.0

func (ChannelsEcBrand) GetMessageType() string

func (ChannelsEcBrand) GetTypeKey added in v1.0.0

func (m ChannelsEcBrand) GetTypeKey() string

func (ChannelsEcBrand) ParseFromJson added in v1.0.0

func (ChannelsEcBrand) ParseFromJson(data []byte) (CallbackExtraInfoInterface, error)

type ChannelsEcComplaintUpdate added in v1.0.0

type ChannelsEcComplaintUpdate struct {
	CreateTime          int    `json:"CreateTime"`
	Event               string `json:"Event"`
	FromUserName        string `json:"FromUserName"`
	MsgType             string `json:"MsgType"`
	ToUserName          string `json:"ToUserName"`
	FinderShopComplaint struct {
		AfterSaleOrderID string `json:"after_sale_order_id"`
		ComplaintID      string `json:"complaint_id"`
		ComplaintStatus  int    `json:"complaint_status"`
		OrderID          string `json:"order_id"`
	} `json:"finder_shop_complaint"`
}

func (ChannelsEcComplaintUpdate) GetEventType added in v1.0.0

func (ChannelsEcComplaintUpdate) GetEventType() string

func (ChannelsEcComplaintUpdate) GetMessageType added in v1.0.0

func (ChannelsEcComplaintUpdate) GetMessageType() string

func (ChannelsEcComplaintUpdate) GetTypeKey added in v1.0.0

func (m ChannelsEcComplaintUpdate) GetTypeKey() string

func (ChannelsEcComplaintUpdate) ParseFromJson added in v1.0.0

type ChannelsEcCouponReceive added in v1.0.0

type ChannelsEcCouponReceive struct {
	CreateTime   int64  `json:"CreateTime"`
	Event        string `json:"Event"`
	FromUserName string `json:"FromUserName"`
	MsgType      string `json:"MsgType"`
	ToUserName   string `json:"ToUserName"`
	ReceiveInfo  struct {
		CouponID     string `json:"coupon_id"`
		ReceiveTime  string `json:"receive_time"`
		UserCouponID string `json:"user_coupon_id"`
	} `json:"receive_info"`
}

func (ChannelsEcCouponReceive) GetEventType added in v1.0.0

func (ChannelsEcCouponReceive) GetEventType() string

func (ChannelsEcCouponReceive) GetMessageType added in v1.0.0

func (ChannelsEcCouponReceive) GetMessageType() string

func (ChannelsEcCouponReceive) GetTypeKey added in v1.0.0

func (m ChannelsEcCouponReceive) GetTypeKey() string

func (ChannelsEcCouponReceive) ParseFromJson added in v1.0.0

type ChannelsEcOrderCancel added in v1.0.0

type ChannelsEcOrderCancel struct {
	CreateTime   int64  `json:"CreateTime"`
	Event        string `json:"Event"`
	FromUserName string `json:"FromUserName"`
	MsgType      string `json:"MsgType"`
	ToUserName   string `json:"ToUserName"`
	OrderInfo    struct {
		CancelType int64  `json:"cancel_type"`
		OrderID    string `json:"order_id"`
	} `json:"order_info"`
}

func (ChannelsEcOrderCancel) GetEventType added in v1.0.0

func (ChannelsEcOrderCancel) GetEventType() string

func (ChannelsEcOrderCancel) GetMessageType added in v1.0.0

func (ChannelsEcOrderCancel) GetMessageType() string

func (ChannelsEcOrderCancel) GetTypeKey added in v1.0.0

func (m ChannelsEcOrderCancel) GetTypeKey() string

func (ChannelsEcOrderCancel) ParseFromJson added in v1.0.0

type ChannelsEcOrderConfirm added in v1.0.0

type ChannelsEcOrderConfirm struct {
	CreateTime   int64  `json:"CreateTime"`
	Event        string `json:"Event"`
	FromUserName string `json:"FromUserName"`
	MsgType      string `json:"MsgType"`
	ToUserName   string `json:"ToUserName"`
	OrderInfo    struct {
		ConfirmType int64  `json:"confirm_type"`
		OrderID     string `json:"order_id"`
	} `json:"order_info"`
}

func (ChannelsEcOrderConfirm) GetEventType added in v1.0.0

func (ChannelsEcOrderConfirm) GetEventType() string

func (ChannelsEcOrderConfirm) GetMessageType added in v1.0.0

func (ChannelsEcOrderConfirm) GetMessageType() string

func (ChannelsEcOrderConfirm) GetTypeKey added in v1.0.0

func (m ChannelsEcOrderConfirm) GetTypeKey() string

func (ChannelsEcOrderConfirm) ParseFromJson added in v1.0.0

type ChannelsEcOrderDeliver added in v1.0.0

type ChannelsEcOrderDeliver struct {
	CreateTime   int64  `json:"CreateTime"`
	Event        string `json:"Event"`
	FromUserName string `json:"FromUserName"`
	MsgType      string `json:"MsgType"`
	ToUserName   string `json:"ToUserName"`
	OrderInfo    struct {
		FinishDelivery int64  `json:"finish_delivery"`
		OrderID        string `json:"order_id"`
	} `json:"order_info"`
}

func (ChannelsEcOrderDeliver) GetEventType added in v1.0.0

func (ChannelsEcOrderDeliver) GetEventType() string

func (ChannelsEcOrderDeliver) GetMessageType added in v1.0.0

func (ChannelsEcOrderDeliver) GetMessageType() string

func (ChannelsEcOrderDeliver) GetTypeKey added in v1.0.0

func (m ChannelsEcOrderDeliver) GetTypeKey() string

func (ChannelsEcOrderDeliver) ParseFromJson added in v1.0.0

type ChannelsEcOrderExtInfoUpdate added in v1.1.6

type ChannelsEcOrderExtInfoUpdate struct {
	CreateTime   int64  `json:"CreateTime"`
	Event        string `json:"Event"`
	FromUserName string `json:"FromUserName"`
	MsgType      string `json:"MsgType"`
	ToUserName   string `json:"ToUserName"`
	OrderInfo    struct {
		OrderID string `json:"order_id"`
		Type    int64  `json:"type"`
	} `json:"order_info"`
}

func (ChannelsEcOrderExtInfoUpdate) GetEventType added in v1.1.6

func (ChannelsEcOrderExtInfoUpdate) GetEventType() string

func (ChannelsEcOrderExtInfoUpdate) GetMessageType added in v1.1.6

func (ChannelsEcOrderExtInfoUpdate) GetMessageType() string

func (ChannelsEcOrderExtInfoUpdate) GetTypeKey added in v1.1.6

func (m ChannelsEcOrderExtInfoUpdate) GetTypeKey() string

func (ChannelsEcOrderExtInfoUpdate) ParseFromJson added in v1.1.6

type ChannelsEcOrderNew added in v1.0.0

type ChannelsEcOrderNew struct {
	CreateTime   int64  `json:"CreateTime"`
	Event        string `json:"Event"`
	FromUserName string `json:"FromUserName"`
	MsgType      string `json:"MsgType"`
	ToUserName   string `json:"ToUserName"`
	OrderInfo    struct {
		OrderID string `json:"order_id"`
	} `json:"order_info"`
}

func (ChannelsEcOrderNew) GetEventType added in v1.0.0

func (ChannelsEcOrderNew) GetEventType() string

func (ChannelsEcOrderNew) GetMessageType added in v1.0.0

func (ChannelsEcOrderNew) GetMessageType() string

func (ChannelsEcOrderNew) GetTypeKey added in v1.0.0

func (m ChannelsEcOrderNew) GetTypeKey() string

func (ChannelsEcOrderNew) ParseFromJson added in v1.0.0

func (ChannelsEcOrderNew) ParseFromJson(data []byte) (CallbackExtraInfoInterface, error)

type ChannelsEcOrderPay added in v1.0.0

type ChannelsEcOrderPay struct {
	CreateTime   int64  `json:"CreateTime"`
	Event        string `json:"Event"`
	FromUserName string `json:"FromUserName"`
	MsgType      string `json:"MsgType"`
	ToUserName   string `json:"ToUserName"`
	OrderInfo    struct {
		OrderID string `json:"order_id"`
		PayTime int64  `json:"pay_time"`
	} `json:"order_info"`
}

func (ChannelsEcOrderPay) GetEventType added in v1.0.0

func (ChannelsEcOrderPay) GetEventType() string

func (ChannelsEcOrderPay) GetMessageType added in v1.0.0

func (ChannelsEcOrderPay) GetMessageType() string

func (ChannelsEcOrderPay) GetTypeKey added in v1.0.0

func (m ChannelsEcOrderPay) GetTypeKey() string

func (ChannelsEcOrderPay) ParseFromJson added in v1.0.0

func (ChannelsEcOrderPay) ParseFromJson(data []byte) (CallbackExtraInfoInterface, error)

type ChannelsEcOrderSettle added in v1.0.0

type ChannelsEcOrderSettle struct {
	CreateTime   int64  `json:"CreateTime"`
	Event        string `json:"Event"`
	FromUserName string `json:"FromUserName"`
	MsgType      string `json:"MsgType"`
	ToUserName   string `json:"ToUserName"`
	OrderInfo    struct {
		OrderID    string `json:"order_id"`
		SettleTime int64  `json:"settle_time"`
	} `json:"order_info"`
}

func (ChannelsEcOrderSettle) GetEventType added in v1.0.0

func (ChannelsEcOrderSettle) GetEventType() string

func (ChannelsEcOrderSettle) GetMessageType added in v1.0.0

func (ChannelsEcOrderSettle) GetMessageType() string

func (ChannelsEcOrderSettle) GetTypeKey added in v1.0.0

func (m ChannelsEcOrderSettle) GetTypeKey() string

func (ChannelsEcOrderSettle) ParseFromJson added in v1.0.0

type ChannelsEcWithdrawNotify added in v1.0.0

type ChannelsEcWithdrawNotify struct {
	CreateTime   int    `json:"CreateTime"`
	Event        string `json:"Event"`
	MsgType      string `json:"MsgType"`
	ToUserName   string `json:"ToUserName"`
	WithdrawInfo struct {
		Event      int    `json:"event"`
		WithdrawID string `json:"withdraw_id"`
	} `json:"withdraw_info"`
}

func (ChannelsEcWithdrawNotify) GetEventType added in v1.0.0

func (ChannelsEcWithdrawNotify) GetEventType() string

func (ChannelsEcWithdrawNotify) GetMessageType added in v1.0.0

func (ChannelsEcWithdrawNotify) GetMessageType() string

func (ChannelsEcWithdrawNotify) GetTypeKey added in v1.0.0

func (m ChannelsEcWithdrawNotify) GetTypeKey() string

func (ChannelsEcWithdrawNotify) ParseFromJson added in v1.0.0

type EventProductSpuAudit

type EventProductSpuAudit struct {
	CreateTime      int64  `json:"CreateTime"`
	Event           string `json:"Event"`
	FromUserName    string `json:"FromUserName"`
	MsgType         string `json:"MsgType"`
	ToUserName      string `json:"ToUserName"`
	ProductSpuAudit struct {
		ProductID string `json:"product_id"`
		Status    int64  `json:"status"`
		Reason    string `json:"reason"`
	} `json:"ProductSpuAudit"`
}

func (EventProductSpuAudit) GetEventType

func (EventProductSpuAudit) GetEventType() string

func (EventProductSpuAudit) GetMessageType

func (EventProductSpuAudit) GetMessageType() string

func (EventProductSpuAudit) GetTypeKey

func (m EventProductSpuAudit) GetTypeKey() string

func (EventProductSpuAudit) ParseFromJson

func (EventProductSpuAudit) ParseFromJson(data []byte) (CallbackExtraInfoInterface, error)

type EventProductSpuListing

type EventProductSpuListing struct {
	CreateTime      int64  `json:"CreateTime"`
	Event           string `json:"Event"`
	FromUserName    string `json:"FromUserName"`
	MsgType         string `json:"MsgType"`
	ToUserName      string `json:"ToUserName"`
	ProductSpuAudit struct {
		ProductID string `json:"product_id"`
		Status    int64  `json:"status"`
		Reason    string `json:"reason"`
	} `json:"ProductSpuAudit"`
}

func (EventProductSpuListing) GetEventType

func (EventProductSpuListing) GetEventType() string

func (EventProductSpuListing) GetMessageType

func (EventProductSpuListing) GetMessageType() string

func (EventProductSpuListing) GetTypeKey

func (m EventProductSpuListing) GetTypeKey() string

func (EventProductSpuListing) ParseFromJson

type EventProductSpuUpdate added in v1.0.0

type EventProductSpuUpdate struct {
	CreateTime       int64  `json:"CreateTime"`
	Event            string `json:"Event"`
	FromUserName     string `json:"FromUserName"`
	MsgType          string `json:"MsgType"`
	ToUserName       string `json:"ToUserName"`
	ProductSpuUpdate struct {
		ProductID string `json:"product_id"`
		Status    int64  `json:"status"`
	} `json:"ProductSpuUpdate"`
}

func (EventProductSpuUpdate) GetEventType added in v1.0.0

func (EventProductSpuUpdate) GetEventType() string

func (EventProductSpuUpdate) GetMessageType added in v1.0.0

func (EventProductSpuUpdate) GetMessageType() string

func (EventProductSpuUpdate) GetTypeKey added in v1.0.0

func (m EventProductSpuUpdate) GetTypeKey() string

func (EventProductSpuUpdate) ParseFromJson added in v1.0.0

type EventType

type EventType string

事件类型

const EventTypeChannelsEcAcctNotify EventType = "channels_ec_acct_notify"

结算账户变更回调

const EventTypeChannelsEcAftersaleUpdate EventType = "channels_ec_aftersale_update"

售后单更新通知

const EventTypeChannelsEcBrand EventType = "channels_ec_brand"

品牌资质事件回调

const EventTypeChannelsEcComplaintUpdate EventType = "channels_ec_complaint_update"

纠纷更新通知

const EventTypeChannelsEcCouponReceive EventType = "channels_ec_coupon_receive"

优惠券领取通知

const EventTypeChannelsEcOrderCancel EventType = "channels_ec_order_cancel"

订单取消

const EventTypeChannelsEcOrderConfirm EventType = "channels_ec_order_confirm"

订单确认收货

const EventTypeChannelsEcOrderDeliver EventType = "channels_ec_order_deliver"

订单发货

const EventTypeChannelsEcOrderExtInfoUpdate EventType = "channels_ec_order_ext_info_update"

订单其他信息更新

const EventTypeChannelsEcOrderNew EventType = "channels_ec_order_new"

订单下单

const EventTypeChannelsEcOrderPay EventType = "channels_ec_order_pay"

订单支付成功

const EventTypeChannelsEcOrderSettle EventType = "channels_ec_order_settle"

订单结算成功

const EventTypeChannelsEcWithdrawNotify EventType = "channels_ec_withdraw_notify"

提现回调

const EventTypeProductCategoryAudit EventType = "product_category_audit"

类目审核结果

const EventTypeProductSpuAudit EventType = "product_spu_audit"

商品审核

const EventTypeProductSpuListing EventType = "product_spu_listing"

商品上下架

const EventTypeProductSpuUpdate EventType = "product_spu_update"

商品编辑

const EventTypeQrcodeStatus EventType = "qrcode_status"

提现二维码回调

type MessageType

type MessageType string

消息类型

const MessageTypeEvent MessageType = "event"

事件消息

const MessageTypeImage MessageType = "image"

图片消息

const MessageTypeLink MessageType = "link"

链接消息

const MessageTypeLocation MessageType = "location"

位置消息

const MessageTypeText MessageType = "text"

文本消息

const MessageTypeUnknown MessageType = "unknown"

没有明确指定消息类型,都视为未知事件

const MessageTypeVideo MessageType = "video"

视频消息

const MessageTypeVoice MessageType = "voice"

语音消息

type ProductCategoryAudit added in v1.0.0

type ProductCategoryAudit struct {
	CreateTime           int    `json:"CreateTime"`
	Event                string `json:"Event"`
	FromUserName         string `json:"FromUserName"`
	MsgType              string `json:"MsgType"`
	ProductCategoryAudit struct {
		AuditID string `json:"audit_id"`
		Reason  string `json:"reason"`
		Status  string `json:"status"`
	} `json:"ProductCategoryAudit"`
	ToUserName string `json:"ToUserName"`
}

func (ProductCategoryAudit) GetEventType added in v1.0.0

func (ProductCategoryAudit) GetEventType() string

func (ProductCategoryAudit) GetMessageType added in v1.0.0

func (ProductCategoryAudit) GetMessageType() string

func (ProductCategoryAudit) GetTypeKey added in v1.0.0

func (m ProductCategoryAudit) GetTypeKey() string

func (ProductCategoryAudit) ParseFromJson added in v1.0.0

func (ProductCategoryAudit) ParseFromJson(data []byte) (CallbackExtraInfoInterface, error)

type ProductOrderStatusUpdate added in v1.0.1

type ProductOrderStatusUpdate struct {
	CreateTime               int64  `json:"CreateTime"`
	Event                    string `json:"Event"`
	FromUserName             string `json:"FromUserName"`
	MsgType                  string `json:"MsgType"`
	ToUserName               string `json:"ToUserName"`
	ProductOrderStatusUpdate struct {
		OrderID string `json:"order_id"`
		Status  int64  `json:"status"`
	} `json:"ProductOrderStatusUpdate"`
}

func (ProductOrderStatusUpdate) GetEventType added in v1.0.1

func (ProductOrderStatusUpdate) GetEventType() string

func (ProductOrderStatusUpdate) GetMessageType added in v1.0.1

func (ProductOrderStatusUpdate) GetMessageType() string

func (ProductOrderStatusUpdate) GetTypeKey added in v1.0.1

func (m ProductOrderStatusUpdate) GetTypeKey() string

func (ProductOrderStatusUpdate) ParseFromJson added in v1.0.1

type QrcodeStatus added in v1.0.0

type QrcodeStatus struct {
	CreateTime int    `json:"CreateTime"`
	Event      string `json:"Event"`
	MsgType    string `json:"MsgType"`
	ToUserName string `json:"ToUserName"`
	QrcodeInfo struct {
		ScanUserType int    `json:"scan_user_type"`
		Status       int    `json:"status"`
		Ticket       string `json:"ticket"`
	} `json:"qrcode_info"`
}

func (QrcodeStatus) GetEventType added in v1.0.0

func (QrcodeStatus) GetEventType() string

func (QrcodeStatus) GetMessageType added in v1.0.0

func (QrcodeStatus) GetMessageType() string

func (QrcodeStatus) GetTypeKey added in v1.0.0

func (m QrcodeStatus) GetTypeKey() string

func (QrcodeStatus) ParseFromJson added in v1.0.0

func (QrcodeStatus) ParseFromJson(data []byte) (CallbackExtraInfoInterface, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL