Documentation
¶
Index ¶
- func Code2Session(code string) (openID, sessionKey, unionID string, err error)
- func GetAccessToken() (string, error)
- func GetMiniProgram() *miniprogram.MiniProgram
- func InitWeChat(cfg *config.WeChatConfig) error
- func SendTemplateMessage(msg *TemplateMessage) error
- type PaymentNotifyData
- type RateLimitedSender
- type TemplateDataItem
- type TemplateMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Code2Session ¶
Code2Session 获取用户session信息
func SendTemplateMessage ¶
func SendTemplateMessage(msg *TemplateMessage) error
SendTemplateMessage 发送模板消息
Types ¶
type PaymentNotifyData ¶
type PaymentNotifyData struct {
ReturnCode string `xml:"return_code"`
ReturnMsg string `xml:"return_msg"`
AppID string `xml:"appid"`
MchID string `xml:"mch_id"`
NonceStr string `xml:"nonce_str"`
Sign string `xml:"sign"`
ResultCode string `xml:"result_code"`
OpenID string `xml:"openid"`
TradeType string `xml:"trade_type"`
BankType string `xml:"bank_type"`
TotalFee int `xml:"total_fee"`
CashFee int `xml:"cash_fee"`
TransactionID string `xml:"transaction_id"`
OutTradeNo string `xml:"out_trade_no"`
TimeEnd string `xml:"time_end"`
}
PaymentNotifyData 支付回调数据
type RateLimitedSender ¶
type RateLimitedSender struct {
// contains filtered or unexported fields
}
RateLimitedSender 限流发送器
func NewRateLimitedSender ¶
func NewRateLimitedSender(ratePerSecond int) *RateLimitedSender
NewRateLimitedSender 创建限流发送器
func (*RateLimitedSender) Send ¶
func (s *RateLimitedSender) Send(msg *TemplateMessage) error
Send 限流发送
type TemplateDataItem ¶
type TemplateDataItem struct {
Value string `json:"value"`
}
TemplateDataItem 模板消息数据项
type TemplateMessage ¶
type TemplateMessage struct {
ToUser string `json:"touser"`
TemplateID string `json:"template_id"`
Page string `json:"page,omitempty"`
Data map[string]interface{} `json:"data"`
MiniprogramState string `json:"miniprogram_state,omitempty"` // developer, trial, formal
}
TemplateMessage 模板消息
Click to show internal directories.
Click to hide internal directories.