callbacks

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 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

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

type CallbackHandler

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

func NewCallbackHandler

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

func (*CallbackHandler) EchoTestHandler

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

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

func (*CallbackHandler) GetCallbackMsg

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

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

func (ChannelsEcAcctNotify) GetEventType() string

func (ChannelsEcAcctNotify) GetMessageType

func (ChannelsEcAcctNotify) GetMessageType() string

func (ChannelsEcAcctNotify) GetTypeKey

func (m ChannelsEcAcctNotify) GetTypeKey() string

func (ChannelsEcAcctNotify) ParseFromJson

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

type ChannelsEcAftersaleUpdate

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

func (ChannelsEcAftersaleUpdate) GetEventType() string

func (ChannelsEcAftersaleUpdate) GetMessageType

func (ChannelsEcAftersaleUpdate) GetMessageType() string

func (ChannelsEcAftersaleUpdate) GetTypeKey

func (m ChannelsEcAftersaleUpdate) GetTypeKey() string

func (ChannelsEcAftersaleUpdate) ParseFromJson

type ChannelsEcBrand

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

func (ChannelsEcBrand) GetEventType() string

func (ChannelsEcBrand) GetMessageType

func (ChannelsEcBrand) GetMessageType() string

func (ChannelsEcBrand) GetTypeKey

func (m ChannelsEcBrand) GetTypeKey() string

func (ChannelsEcBrand) ParseFromJson

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

type ChannelsEcComplaintUpdate

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

func (ChannelsEcComplaintUpdate) GetEventType() string

func (ChannelsEcComplaintUpdate) GetMessageType

func (ChannelsEcComplaintUpdate) GetMessageType() string

func (ChannelsEcComplaintUpdate) GetTypeKey

func (m ChannelsEcComplaintUpdate) GetTypeKey() string

func (ChannelsEcComplaintUpdate) ParseFromJson

type ChannelsEcCouponReceive

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

func (ChannelsEcCouponReceive) GetEventType() string

func (ChannelsEcCouponReceive) GetMessageType

func (ChannelsEcCouponReceive) GetMessageType() string

func (ChannelsEcCouponReceive) GetTypeKey

func (m ChannelsEcCouponReceive) GetTypeKey() string

func (ChannelsEcCouponReceive) ParseFromJson

type ChannelsEcOrderCancel

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

func (ChannelsEcOrderCancel) GetEventType() string

func (ChannelsEcOrderCancel) GetMessageType

func (ChannelsEcOrderCancel) GetMessageType() string

func (ChannelsEcOrderCancel) GetTypeKey

func (m ChannelsEcOrderCancel) GetTypeKey() string

func (ChannelsEcOrderCancel) ParseFromJson

type ChannelsEcOrderConfirm

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

func (ChannelsEcOrderConfirm) GetEventType() string

func (ChannelsEcOrderConfirm) GetMessageType

func (ChannelsEcOrderConfirm) GetMessageType() string

func (ChannelsEcOrderConfirm) GetTypeKey

func (m ChannelsEcOrderConfirm) GetTypeKey() string

func (ChannelsEcOrderConfirm) ParseFromJson

type ChannelsEcOrderDeliver

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

func (ChannelsEcOrderDeliver) GetEventType() string

func (ChannelsEcOrderDeliver) GetMessageType

func (ChannelsEcOrderDeliver) GetMessageType() string

func (ChannelsEcOrderDeliver) GetTypeKey

func (m ChannelsEcOrderDeliver) GetTypeKey() string

func (ChannelsEcOrderDeliver) ParseFromJson

type ChannelsEcOrderExtInfoUpdate

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

func (ChannelsEcOrderExtInfoUpdate) GetEventType() string

func (ChannelsEcOrderExtInfoUpdate) GetMessageType

func (ChannelsEcOrderExtInfoUpdate) GetMessageType() string

func (ChannelsEcOrderExtInfoUpdate) GetTypeKey

func (m ChannelsEcOrderExtInfoUpdate) GetTypeKey() string

func (ChannelsEcOrderExtInfoUpdate) ParseFromJson

type ChannelsEcOrderNew

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

func (ChannelsEcOrderNew) GetEventType() string

func (ChannelsEcOrderNew) GetMessageType

func (ChannelsEcOrderNew) GetMessageType() string

func (ChannelsEcOrderNew) GetTypeKey

func (m ChannelsEcOrderNew) GetTypeKey() string

func (ChannelsEcOrderNew) ParseFromJson

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

type ChannelsEcOrderPay

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

func (ChannelsEcOrderPay) GetEventType() string

func (ChannelsEcOrderPay) GetMessageType

func (ChannelsEcOrderPay) GetMessageType() string

func (ChannelsEcOrderPay) GetTypeKey

func (m ChannelsEcOrderPay) GetTypeKey() string

func (ChannelsEcOrderPay) ParseFromJson

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

type ChannelsEcOrderSettle

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

func (ChannelsEcOrderSettle) GetEventType() string

func (ChannelsEcOrderSettle) GetMessageType

func (ChannelsEcOrderSettle) GetMessageType() string

func (ChannelsEcOrderSettle) GetTypeKey

func (m ChannelsEcOrderSettle) GetTypeKey() string

func (ChannelsEcOrderSettle) ParseFromJson

type ChannelsEcWithdrawNotify

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

func (ChannelsEcWithdrawNotify) GetEventType() string

func (ChannelsEcWithdrawNotify) GetMessageType

func (ChannelsEcWithdrawNotify) GetMessageType() string

func (ChannelsEcWithdrawNotify) GetTypeKey

func (m ChannelsEcWithdrawNotify) GetTypeKey() string

func (ChannelsEcWithdrawNotify) ParseFromJson

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

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

func (EventProductSpuUpdate) GetEventType() string

func (EventProductSpuUpdate) GetMessageType

func (EventProductSpuUpdate) GetMessageType() string

func (EventProductSpuUpdate) GetTypeKey

func (m EventProductSpuUpdate) GetTypeKey() string

func (EventProductSpuUpdate) ParseFromJson

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

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

func (ProductCategoryAudit) GetEventType() string

func (ProductCategoryAudit) GetMessageType

func (ProductCategoryAudit) GetMessageType() string

func (ProductCategoryAudit) GetTypeKey

func (m ProductCategoryAudit) GetTypeKey() string

func (ProductCategoryAudit) ParseFromJson

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

type ProductOrderStatusUpdate

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

func (ProductOrderStatusUpdate) GetEventType() string

func (ProductOrderStatusUpdate) GetMessageType

func (ProductOrderStatusUpdate) GetMessageType() string

func (ProductOrderStatusUpdate) GetTypeKey

func (m ProductOrderStatusUpdate) GetTypeKey() string

func (ProductOrderStatusUpdate) ParseFromJson

type QrcodeStatus

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

func (QrcodeStatus) GetEventType() string

func (QrcodeStatus) GetMessageType

func (QrcodeStatus) GetMessageType() string

func (QrcodeStatus) GetTypeKey

func (m QrcodeStatus) GetTypeKey() string

func (QrcodeStatus) ParseFromJson

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