wechat

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Text     = "text"
	Location = "location"
	Image    = "image"
	Link     = "link"
	Event    = "event"
	Music    = "music"
	News     = "news"

	TOKENIGNORE   = -1
	TOKENRETURN   = 0
	TOKENCONTINUE = 1

	URLGETCALLBACKIP = "https://api.weixin.qq.com/cgi-bin/getcallbackip"
	URLTOKEN         = "https://api.weixin.qq.com/cgi-bin/token"
	URLGETTICKET     = "https://api.weixin.qq.com/cgi-bin/ticket/getticket"
)

基础定义

View Source
const (
	URLCardCreate          = "https://api.weixin.qq.com/card/create"              //创建卡券
	URLCardPaycell         = "https://api.weixin.qq.com/card/paycell/set"         //设置买单接口
	URLCardSelfconsumecell = "https://api.weixin.qq.com/card/selfconsumecell/set" //设置自助核销
	URLCardQrcode          = "https://api.weixin.qq.com/card/qrcode/create"       //创建二维码

	URLCardCodeGet         = "https://api.weixin.qq.com/card/code/get"         //查询Code接口
	URLCardUserGetcardlist = "https://api.weixin.qq.com/card/user/getcardlist" //获取用户已领取卡券接口
	URLCardGet             = "https://api.weixin.qq.com/card/get"              //查看卡券详情
	URLCardBatchget        = "https://api.weixin.qq.com/card/batchget"         //批量获取卡券
)

卡券相关接口地址

View Source
const (
	URLMediaUpload           = "https://api.weixin.qq.com/cgi-bin/media/upload"
	URLMediaGet              = "https://api.weixin.qq.com/cgi-bin/media/get"
	URLMediaAddNews          = "https://api.weixin.qq.com/cgi-bin/material/add_news"
	URLMediaUpdateNews       = "https://api.weixin.qq.com/cgi-bin/material/update_news"
	URLMediaUploadImg        = "https://api.weixin.qq.com/cgi-bin/media/uploadimg"
	URLMediaAddMaterial      = "https://api.weixin.qq.com/cgi-bin/material/add_material"
	URLMediaDelMaterial      = "https://api.weixin.qq.com/cgi-bin/material/del_material"
	URLMediaGetMaterial      = "https://api.weixin.qq.com/cgi-bin/material/get_material"
	URLMediaBatchgetMaterial = "https://api.weixin.qq.com/cgi-bin/material/batchget_material"
)

base url

View Source
const (
	URLMENUGET            = "https://api.weixin.qq.com/cgi-bin/menu/get"
	URLMENUCREATE         = "https://api.weixin.qq.com/cgi-bin/menu/create"
	URLMENUADDCONDITIONAL = "https://api.weixin.qq.com/cgi-bin/menu/addconditional"
	URLMENUDELCONDITIONAL = "https://api.weixin.qq.com/cgi-bin/menu/delconditional"
	URLMENUDELETE         = "https://api.weixin.qq.com/cgi-bin/menu/delete"
)

base url

View Source
const (
	URLMASSSENDALL  = "https://api.weixin.qq.com/cgi-bin/message/mass/sendall"
	URLMASSSENDLIST = "https://api.weixin.qq.com/cgi-bin/message/mass/send"
	URLMASSDELETE   = "https://api.weixin.qq.com/cgi-bin/message/mass/delete"
	URLMASSPREVIEW  = "https://api.weixin.qq.com/cgi-bin/message/mass/preview"
	URLMASSSEND     = "https://api.weixin.qq.com/cgi-bin/message/custom/send"
)

base url

View Source
const (
	//下单
	URLPAYUNIFIEDORDER = "https://api.mch.weixin.qq.com/pay/unifiedorder"

	//查询订单
	URLPAYORDERQUERY = "https://api.mch.weixin.qq.com/pay/orderquery"

	//关闭订单
	URLPAYCLOSEORDER = "https://api.mch.weixin.qq.com/pay/closeorder"

	//下载交易账单
	URLDOWNLOADBILL = "https://api.mch.weixin.qq.com/pay/downloadbill"

	//申请退款
	URLPAYREFUND = "https://api.mch.weixin.qq.com/secapi/pay/refund"

	//查询退款
	URLPAYREFUNDQUERY = "https://api.mch.weixin.qq.com/pay/refundquery"
)

baseurl

View Source
const (
	URLAddPoi        = "http://api.weixin.qq.com/cgi-bin/poi/addpoi"
	URLGetPoi        = "http://api.weixin.qq.com/cgi-bin/poi/getpoi"
	URLGetPoiList    = "https://api.weixin.qq.com/cgi-bin/poi/getpoilist"
	URLUpdatePoi     = "https://api.weixin.qq.com/cgi-bin/poi/updatepoi"
	URLDelPoi        = "https://api.weixin.qq.com/cgi-bin/poi/delpoi"
	URLGetWxCategory = "http://api.weixin.qq.com/cgi-bin/poi/getwxcategory"
)

门店接口地址

View Source
const (
	URLUSERACCESSTOKEN        = "https://api.weixin.qq.com/sns/oauth2/access_token"
	URLUSERUSERINFO           = "https://api.weixin.qq.com/sns/userinfo"
	URLUSERINFO               = "https://api.weixin.qq.com/cgi-bin/user/info"
	URLUSERBATCHGET           = "https://api.weixin.qq.com/cgi-bin/user/info/batchget"
	URLUSERGET                = "https://api.weixin.qq.com/cgi-bin/user/get"
	URLUSERGROUPCREATE        = "https://api.weixin.qq.com/cgi-bin/groups/create"
	URLUSERGROUPGET           = "https://api.weixin.qq.com/cgi-bin/groups/get"
	URLUSERGROUPGETID         = "https://api.weixin.qq.com/cgi-bin/groups/getid"
	URLUSERGROUPUPDATE        = "https://api.weixin.qq.com/cgi-bin/groups/update"
	URLUSERGROUPMEMBERSUPDATE = "https://api.weixin.qq.com/cgi-bin/groups/members/update"
	URLUSERTAGCREATE          = "https://api.weixin.qq.com/cgi-bin/tags/create"
	URLUSERTAGGET             = "https://api.weixin.qq.com/cgi-bin/tags/get"
	URLUSERTAGUPDATE          = "https://api.weixin.qq.com/cgi-bin/tags/update"
	URLUSERTAGDELETE          = "https://api.weixin.qq.com/cgi-bin/tags/delete"
	URLUSERTAGGETIDLIST       = "https://api.weixin.qq.com/cgi-bin/tags/getidlist"
	URLUSERTAGBATCHTAGGING    = "https://api.weixin.qq.com/cgi-bin/tags/members/batchtagging"
	URLUSERTAGBATCHUNTAGGING  = "https://api.weixin.qq.com/cgi-bin/tags/members/batchuntagging"
	URLUSERUPDATEREMARK       = "https://api.weixin.qq.com/cgi-bin/user/info/updateremark"
	URLJSCODE2SESSION         = "https://api.weixin.qq.com/sns/jscode2session"
)

base url

View Source
const (
	TEMPLATESENDURL = "https://api.weixin.qq.com/cgi-bin/message/template/send"
)

访问地址

Variables

This section is empty.

Functions

func AesECBDecrypt

func AesECBDecrypt(key []byte, ciphertext []byte, paddingType ...string) (plaintext []byte, err error)

AesECBDecrypt AesECBDecrypt

func CreateArticlesRes

func CreateArticlesRes(req *STMsgRequest, data []TArticle) (res interface{}, err error)

CreateArticlesRes 创建自动回复文章类消息

func CreateImageRes

func CreateImageRes(req *STMsgRequest, Mediaid string) (res interface{}, err error)

CreateImageRes 创建自动回复图片类消息

func CreateMusicRes

func CreateMusicRes(req *STMsgRequest, Title, Description, MusicURL, HQMusicURL, ThumbMediaid string) (res interface{}, err error)

CreateMusicRes 创建自动回复音乐类消息

func CreateTextRes

func CreateTextRes(req *STMsgRequest, Content string) (res interface{}, err error)

CreateTextRes 创建自动回复文字类消息

func CreateVideoRes

func CreateVideoRes(req *STMsgRequest, Title, Description, Mediaid string) (res interface{}, err error)

CreateVideoRes 创建自动回复视频类消息

func CreateVoiceRes

func CreateVoiceRes(req *STMsgRequest, Mediaid string) (res interface{}, err error)

CreateVoiceRes 创建自动回复语音类消息

func NewECBDecrypter

func NewECBDecrypter(b cipher.Block) cipher.BlockMode

NewECBDecrypter returns a BlockMode which decrypts in electronic code book mode, using the given Block.

func NewECBEncrypter

func NewECBEncrypter(b cipher.Block) cipher.BlockMode

NewECBEncrypter returns a BlockMode which encrypts in electronic code book mode, using the given Block.

func PKCS7Padding

func PKCS7Padding(ciphertext []byte, blockSize int) []byte

PKCS7Padding PKCS7Padding

func PKCS7UnPadding

func PKCS7UnPadding(origData []byte) []byte

PKCS7UnPadding PKCS7UnPadding

Types

type CallBackRefund

type CallBackRefund struct {
	Transactionid       string `xml:"transaction_id"`
	OutTradeNo          string `xml:"out_trade_no"`
	RefundID            string `xml:"refund_id"`
	OutRefundNo         string `xml:"out_refund_no"`
	TotalFee            int    `xml:"total_fee"`
	SettlementTotalFee  int    `xml:"settlement_total_fee,omitempty"`
	RefundFee           int    `xml:"refund_fee"`
	SettlementRefundFee int    `xml:"settlement_refund_fe"`
	RefundStatus        string `xml:"refund_status"`
	SuccessTime         string `xml:"success_time,omitempty"`
	RefundRecvAccout    string `xml:"refund_recv_accout"`
	RefundAccount       string `xml:"refund_account"`
	RefundRequestSource string `xml:"refund_request_source"`
}

CallBackRefund 微信退款回调信息

type MchInfo

type MchInfo struct {
	MchID    string
	PayKey   string
	CertPath string
	KeyPath  string
	CaPath   string
	// contains filtered or unexported fields
}

MchInfo 微信商户信息

type ReqDownloadBill

type ReqDownloadBill struct {
	XMLName  xml.Name `xml:"xml"`
	Appid    string   `xml:"appid"`
	Mchid    string   `xml:"mch_id"`
	BiilDate string   `xml:"bill_date"`
	BillType string   `xml:"bill_type"`
	Noncestr string   `xml:"nonce_str"`
	Sign     string   `xml:"sign"`
}

ReqDownloadBill 请求下载对账单

type ReqHongbao

type ReqHongbao struct {
	XMLName     xml.Name `xml:"xml"`
	NonceStr    string   `xml:"nonce_str"`
	Sign        string   `xml:"sign"`
	MchBillno   string   `xml:"mch_billno"`
	Mchid       string   `xml:"mch_id"`
	Wxappid     string   `xml:"wxappid"`
	SendName    string   `xml:"send_name"`
	ReOpenid    string   `xml:"re_openid"`
	TotalAmount int      `xml:"total_amount"`
	TotalNum    int      `xml:"total_num"`
	Wishing     string   `xml:"wishing"`
	ClientIP    string   `xml:"client_ip"`
	ActName     string   `xml:"act_name"`
	Remark      string   `xml:"remark"`
}

ReqHongbao 红包发送结构体

type ReqMedia

type ReqMedia struct {
	Mediaid string `josn:"media_id"`
	URL     string `json:"url"`
}

ReqMedia ReqMedia

type ReqQueryOrder

type ReqQueryOrder struct {
	XMLName       xml.Name `xml:"xml"`
	Appid         string   `xml:"appid"`
	Mchid         string   `xml:"mch_id"`
	Transactionid string   `xml:"transaction_id,omitempty"`
	OutTradeNo    string   `xml:"out_trade_no,omitempty"`
	Noncestr      string   `xml:"nonce_str"`
	Sign          string   `xml:"sign"`
}

ReqQueryOrder 订单查询结构体

type ReqRefund

type ReqRefund struct {
	XMLName       xml.Name `xml:"xml"`
	Appid         string   `xml:"appid"`
	Mchid         string   `xml:"mch_id"`
	NonceStr      string   `xml:"nonce_str"`
	Sign          string   `xml:"sign"`
	SignType      string   `xml:"sign_type,omitempty"`
	Transactionid string   `xml:"transaction_id,omitempty"`
	OutTradeNo    string   `xml:"out_trade_no,omitempty"`
	OutRefundNo   string   `xml:"out_refund_no"`
	TotalFee      int      `xml:"total_fee"`
	RefundFee     int      `xml:"refund_fee"`
	RefundFeeType string   `xml:"refund_fee_type,omitempty"`
	RefundDesc    string   `xml:"refund_desc,omitempty"`
	RefundAccount string   `xml:"refund_account,omitempty"`
	NotifyURL     string   `xml:"notify_url,omitempty"`
}

ReqRefund 退款申请请求

type ReqRefundquery

type ReqRefundquery struct {
	XMLName       xml.Name `xml:"xml"`
	Appid         string   `xml:"appid"`
	Mchid         string   `xml:"mch_id"`
	NonceStr      string   `xml:"nonce_str"`
	Sign          string   `xml:"sign"`
	SignType      string   `xml:"sign_type,omitempty"`
	Transactionid string   `xml:"transaction_id,omitempty,"`
	OutTradeNo    string   `xml:"out_trade_no,omitempty"`
	OutRefundNo   string   `xml:"out_refund_no,omitempty"`
	RefundID      string   `xml:"refund_id,omitempty"`
	Offset        int      `xml:"offset,omitempty"`
}

ReqRefundquery 退款查询

type ReqUnifiedOrder

type ReqUnifiedOrder struct {
	XMLName        xml.Name `xml:"xml"`
	Appid          string   `xml:"appid"`
	Mchid          string   `xml:"mch_id"`
	DeviceInfo     string   `xml:"device_info,omitempty"`
	NonceStr       string   `xml:"nonce_str"`
	Sign           string   `xml:"sign"`
	Body           string   `xml:"body"`
	Detail         string   `xml:"detail,omitempty"`
	Attach         string   `xml:"attach,omitempty"`
	OutTradeNo     string   `xml:"out_trade_no"`
	FeeType        string   `xml:"fee_type,omitempty"`
	TotalFee       int      `xml:"total_fee"`
	SpbillCreateIP string   `xml:"spbill_create_ip"`
	TimeStart      string   `xml:"time_start,omitempty"`
	TimeExpire     string   `xml:"time_expire,omitempty"`
	GoodsTag       string   `xml:"goods_tag,omitempty"`
	NotifyURL      string   `xml:"notify_url"`
	TradeType      string   `xml:"trade_type"`
	Productid      string   `xml:"product_id,omitempty"`
	LimitPay       string   `xml:"limit_pay,omitempty"`
	Openid         string   `xml:"openid,omitempty"`
	SceneInfo      string   `xml:"scene_info,omitempty"`
}

ReqUnifiedOrder 下单

type ResAccessToken

type ResAccessToken struct {
	AccessToken string `json:"access_token"`
	Expiresin   int    `json:"expires_in"`
	Errcode     string `json:"errcode"`
}

ResAccessToken ResAccessToken

type ResCallBackRefund

type ResCallBackRefund 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"`
	ReqInfo    string `xml:"req_info"`
}

ResCallBackRefund 微信退款回调

type ResCloseOrder

type ResCloseOrder struct {
	ReturnCode string `xml:"return_code"`
	ReturnMsg  string `xml:"return_msg,omitempty"`
	Appid      string `xml:"appid"`
	Mchid      string `xml:"mch_id"`
	NonceStr   string `xml:"nonce_str"`
	Sign       string `xml:"sign,omitempty"`
	ResultCode string `xml:"result_code"`
	ErrCode    string `xml:"err_code,omitempty"`
	ErrCodeDes string `xml:"err_code_des,omitempty"`
}

ResCloseOrder 关闭订单

type ResHongbao

type ResHongbao struct {
	XMLName    xml.Name `xml:"xml"`
	ReturnCode string   `xml:"return_code"`
	ReturnMsg  string   `xml:"return_msg,omitempty"`
	ResultCode string   `xml:"result_code"`
	ErrCode    string   `xml:"err_code"`
	ErrCodeSes string   `xml:"err_code_des"`
	MchBillno  string   `xml:"mch_billno"`
	Mchid      string   `xml:"mch_id"`
	Wxappid    string   `xml:"wxappid"`
	ReOpenid   string   `xml:"re_openid"`
	SendListid string   `xml:"send_listid"`
}

ResHongbao ResHongbao

type ResMedia

type ResMedia struct {
	Type      string `json:"type"`
	Mediaid   string `json:"media_id"`
	CreatedAt int64  `json:"created_at"`
	URL       string `json:"url"`
}

ResMedia 媒体返回

type ResMsg

type ResMsg struct {
	Type      string `json:"type"`
	Msgid     int64  `json:"msgid"`
	MsgDataid int64  `json:"msg_data_id"`
}

ResMsg ResMsg type 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb),news,即图文消息 errcode 错误码 errmsg 错误信息 msgid 消息发送任务的ID msg_data_id

type ResNews

type ResNews struct {
	TotalCount int         `json:"total_count"`
	ItemCount  int         `json:"item_count"`
	Item       []TNewsItem `json:"item"`
}

ResNews ResNews

type ResQueryOrder

type ResQueryOrder struct {
	ReturnCode         string `xml:"return_code,omitempty"`
	ReturnMsg          string `xml:"return_msg,omitempty"`
	Appid              string `xml:"appid,omitempty"`
	Mchid              string `xml:"mch_id,omitempty"`
	NonceStr           string `xml:"nonce_str,omitempty"`
	Sign               string `xml:"sign,omitempty"`
	SignType           string `xml:"sign_type,omitempty"`
	ResultCode         string `xml:"result_code,omitempty"`
	ErrCode            string `xml:"err_code,omitempty"`
	ErrCodeDes         string `xml:"err_code_des,omitempty"`
	DeviceInfo         string `xml:"device_info,omitempty"`
	Openid             string `xml:"openid,omitempty"`
	IsSubscribe        string `xml:"is_subscribe,omitempty"`
	TradeType          string `xml:"trade_type,omitempty"`
	TradeState         string `xml:"trade_state,omitempty"`
	BankType           string `xml:"bank_type,omitempty"`
	TotalFee           int    `xml:"total_fee,omitempty"`
	SettlementTotalFee int    `xml:"settlement_total_fee,omitempty"`
	FeeType            string `xml:"fee_type,omitempty"`
	CashFee            int    `xml:"cash_fee,omitempty"`
	CashFeeType        string `xml:"cash_fee_type,omitempty"`
	CouponFee          int    `xml:"coupon_fee,omitempty"`
	CouponCount        int    `xml:"coupon_count,omitempty"`
	CouponType0        int    `xml:"coupon_type_0,omitempty"`
	CouponId0          int    `xml:"coupon_id_0,omitempty"`
	CouponFee0         int    `xml:"coupon_fee_0,omitempty"`
	CouponType1        int    `xml:"coupon_type_1,omitempty"`
	CouponId1          int    `xml:"coupon_id_1,omitempty"`
	CouponFee1         int    `xml:"coupon_fee_1,omitempty"`
	CouponType2        int    `xml:"coupon_type_2,omitempty"`
	CouponId2          int    `xml:"coupon_id_2,omitempty"`
	CouponFee2         int    `xml:"coupon_fee_2,omitempty"`
	Transactionid      string `xml:"transaction_id,omitempty"`
	OutTradeNo         string `xml:"out_trade_no,omitempty"`
	Attach             string `xml:"attach,omitempty"`
	TimeEnd            string `xml:"time_end,omitempty"`
	TradeStateDesc     string `xml:"trade_state_desc,omitempty"`
}

ResQueryOrder 订单查询

type ResRefund

type ResRefund struct {
	ReturnCode          string `xml:"return_code"`
	ReturnMsg           string `xml:"return_msg,omitempty"`
	Appid               string `xml:"appid"`
	Mchid               string `xml:"mch_id"`
	NonceStr            string `xml:"nonce_str"`
	Sign                string `xml:"sign"`
	Transactionid       string `xml:"transaction_id"`
	OutTradeNo          string `xml:"out_trade_no"`
	OutRefundNo         string `xml:"out_refund_no"`
	RefundID            string `xml:"refund_id"`
	RefundChannel       string `xml:"refund_channel"`
	RefundFee           int    `xml:"refund_fee"`
	SettlementRefundFee int    `xml:"settlement_refund_fee,omitempty"`
	TotalFee            int    `xml:"total_fee"`
	SettlementTotalFee  int    `xml:"settlement_total_fee,omitempty"`
	FeeType             string `xml:"fee_type,omitempty"`
	CashFee             int    `xml:"cash_fee"`
	CashFeeType         string `xml:"cash_fee_type,omitempty"`
	CashRefundFee       int    `xml:"cash_refund_fee,omitempty"`
	CouponRefundFee     int    `xml:"coupon_refund_fee"`
	CouponRefundCount   int    `xml:"coupon_refund_count"`
	ResultCode          string `xml:"result_code"`
	ErrCode             string `xml:"err_code,omitempty"`
	ErrCodeDes          string `xml:"err_code_des,omitempty"`
}

ResRefund 退款申请返回

type ResReqRefundquery

type ResReqRefundquery struct {
	ReturnCode         string `xml:"return_code"`
	ReturnMsg          string `xml:"return_msg,omitempty"`
	Appid              string `xml:"appid"`
	Mchid              string `xml:"mch_id"`
	NonceStr           string `xml:"nonce_str"`
	Sign               string `xml:"sign,omitempty"`
	TotalRefundCount   int    `xml:"total_refund_count,omitempty"`
	Transactionid      string `xml:"transaction_id"`
	OutTradeNo         string `xml:"out_trade_no"`
	TotalFee           int    `xml:"total_fee"`
	SettlementTotalFee int    `xml:"settlement_total_fee,omitempty"`
	FeeType            string `xml:"fee_type,omitempty"`
	CashFee            int    `xml:"cash_fee"`
	RefundCount        int    `xml:"refund_count"`

	OutRefundNo         string `xml:"out_refund_no,omitempty"`
	RefundID            string `xml:"refund_id,omitempty"`
	RefundFee           int    `xml:"refund_fee,omitempty"`
	SettlementRefundFee int    `xml:"settlement_refund_fe,omitempty"`
	RefundChannel       string `xml:"refund_channel,omitempty"`
	RefundStatus        string `xml:"refund_status,omitempty"`
	RefundAccount       string `xml:"refund_account,omitempty"`
	RefundRecvAccout    string `xml:"refund_recv_accout,omitempty"`
	RefundSuccessTime   string `xml:"refund_success_time,omitempty"`

	OutRefundNo0         string `xml:"out_refund_no_0,omitempty"`
	RefundID0            string `xml:"refund_id_0,omitempty"`
	RefundFee0           int    `xml:"refund_fee_0,omitempty"`
	SettlementRefundFee0 int    `xml:"settlement_refund_fee0,omitempty"`
	RefundChannel0       string `xml:"refund_channel_0,omitempty"`
	RefundStatus0        string `xml:"refund_status_0,omitempty"`
	RefundAccount0       string `xml:"refund_account_0,omitempty"`
	RefundRecvAccout0    string `xml:"refund_recv_accout_0,omitempty"`
	RefundSuccessTime0   string `xml:"refund_success_time_0,omitempty"`

	OutRefundNo1         string `xml:"out_refund_no_1,omitempty"`
	RefundID1            string `xml:"refund_id_1,omitempty"`
	RefundFee1           int    `xml:"refund_fee_1,omitempty"`
	SettlementRefundFee1 int    `xml:"settlement_refund_fee1,omitempty"`
	RefundChannel1       string `xml:"refund_channel_1,omitempty"`
	RefundStatus1        string `xml:"refund_status_1,omitempty"`
	RefundAccount1       string `xml:"refund_account_1,omitempty"`
	RefundRecvAccout1    string `xml:"refund_recv_accout_1,omitempty"`
	RefundSuccessTime1   string `xml:"refund_success_time_1,omitempty"`

	CashRefundFee     int    `xml:"cash_refund_fee,omitempty"`
	CouponRefundFee   int    `xml:"coupon_refund_fee,omitempty"`
	CouponRefundCount int    `xml:"coupon_refund_count,omitempty"`
	ResultCode        string `xml:"result_code"`
	ErrCode           string `xml:"err_code,omitempty"`
	ErrCodeDes        string `xml:"err_code_des,omitempty"`
}

ResReqRefundquery 退款查询返回

type ResUnifiedOrder

type ResUnifiedOrder struct {
	XMLName    xml.Name `xml:"xml"`
	ReturnCode string   `xml:"return_code"`
	ReturnMsg  string   `xml:"return_msg,omitempty"`
	Appid      string   `xml:"appid"`
	Mchid      string   `xml:"mch_id"`
	DeviceInfo string   `xml:"device_info,omitempty"`
	NonceStr   string   `xml:"nonce_str"`
	Sign       string   `xml:"sign"`
	ResultCode string   `xml:"result_code"`
	ErrCode    string   `xml:"err_code,omitempty"`
	ErrCodeDes string   `xml:"err_code_des,omitempty"`
	TradeType  string   `xml:"trade_type"`
	Prepayid   string   `xml:"prepay_id"`
	CodeURL    string   `xml:"code_url,omitempty"`
	MwebURL    string   `xml:"mweb_url,omitempty"`
}

ResUnifiedOrder 下单返回

type ResUserToken

type ResUserToken struct {
	AccessToken string `json:"access_token"`
	Expiresin   int    `json:"expires_in"`
	Openid      string `json:"openid"`
	Scope       string `json:"scope"`
	Errmsg      string `json:"Errmsg"`
}

ResUserToken 用户Token

type STArticles

type STArticles struct {
	Articles []TArticle `xml:"Articles,omitempty"`
	Mediaid  string     `xml:"MediaId,omitempty" json:"media_id,omitempty"`
}

STArticles 文章类

type STAutoReply

type STAutoReply struct {
	AutoReplyid int        //自动回复ID
	ReqType     string     //请求类型
	ReqContent  string     //请求内容
	ReqEvent    string     //请求事件
	ReqEventkey string     //请求事件key
	ResType     string     //自动回复类型
	ResTitle    string     //自动回复标题
	ResContent  string     //自动回复内容
	ResMediaid  string     //自动回复媒体ID
	ResArticles []TArticle //自动回复文章
}

STAutoReply 自动回复表

type STButton

type STButton struct {
	Name      string     `json:"name,omitempty"`
	Type      string     `json:"type,omitempty"`
	Key       string     `json:"key,omitempty"`
	URL       string     `json:"url,omitempty"`
	Mediaid   string     `json:"media_id,omitempty"`
	SubButton []STButton `json:"sub_button,omitempty"`
}

STButton 按钮元素

type STCondMenu

type STCondMenu struct {
	Button    []STButton  `json:"button"`
	Matchrule STMatchrule `json:"matchrule"`
	Menuid    string      `json:"menuid,omitempty"`
}

STCondMenu 自定义菜单

type STFilter

type STFilter struct {
	IsToAll bool `json:"is_to_all"`
	Tagid   int  `json:"tag_id,omitempty"`
}

STFilter STFilter

type STGroups

type STGroups struct {
	Groupsid   int    `json:"id"`
	Groupsname string `json:"name"`
}

STGroups STGroups

type STMatchrule

type STMatchrule struct {
	Groupid            string `json:"group_id,omitempty"`
	Sex                string `json:"sex,omitempty"`
	ClientPlatformType string `json:"client_platform_type,omitempty"`
	Country            string `json:"country,omitempty"`
	Province           string `json:"province,omitempty"`
	City               string `json:"city,omitempty"`
	Language           string `json:"language,omitempty"`
}

STMatchrule 匹配规则

type STMediaid

type STMediaid struct {
	Mediaid string `json:"media_id,omitempty"`
}

STMediaid 媒体ID

type STMenu

type STMenu struct {
	Button []STButton `json:"button"`
}

STMenu 普通菜单

type STMenus

type STMenus struct {
	Menu     STMenu       `json:"menu"`
	CondMenu []STCondMenu `json:"conditionalmenu"`
}

STMenus 获取菜单

type STMsgRequest

type STMsgRequest struct {
	XMLName              xml.Name `xml:"xml"`
	ToUserName           string
	FromUserName         string
	CreateTime           time.Duration
	MsgType              string
	Content              string
	Mediaid              string
	LocationX, LocationY float32
	Scale                int
	Label                string
	PicURL               string
	Msgid                int
	Event                string
	EventKey             string
	Ticket               string
	Title                string
	Description          string
}

STMsgRequest 请求参数

func DecodeRequest

func DecodeRequest(data []byte) (req *STMsgRequest, err error)

DecodeRequest 解析请求

type STMsgResponse

type STMsgResponse struct {
	XMLName      xml.Name      `xml:"xml"`
	ToUserName   string        `xml:",omitempty"`
	FromUserName string        `xml:",omitempty"`
	CreateTime   time.Duration `xml:",omitempty"`
	MsgType      string        `xml:",omitempty"`
	Content      string        `xml:",omitempty"`
	Image        *STMediaid    `xml:",omitempty"`
	Voice        *STMediaid    `xml:",omitempty"`
	Music        *STMusic      `xml:",omitempty"`
	Video        *STVideo      `xml:",omitempty"`
	ArticleCount int           `xml:",omitempty"`
	Articles     *STArticles   `xml:",omitempty"`
}

STMsgResponse 返回参数

type STMusic

type STMusic struct {
	Title        string //音乐标题
	Description  string //音乐描述
	MusicURL     string //音乐链接
	HQMusicURL   string //高质量音乐链接,WIFI环境优先使用该链接播放音乐
	ThumbMediaid string //缩略图的媒体id,通过素材管理接口上传多媒体文件,得到的id
}

STMusic 音乐类

type STNews

type STNews struct {
	TNews
	URL      string `json:"url"`
	ThumbURL string `json:"thumb_url"`
}

STNews 图文信息返回

type STOpenid

type STOpenid struct {
	Openid string `json:"openid"`
}

STOpenid STOpenid

type STOpenids

type STOpenids struct {
	Openid []string `json:"openid"`
}

STOpenids STOpenids

type STTag

type STTag struct {
	Tagid   int    `json:"id,omitempty"`
	Tagname string `json:"name,omitempty"`
}

STTag STTag

type STText

type STText struct {
	Content string `json:"content,omitempty"`
}

STText 文字消息

type STUserInfo

type STUserInfo struct {
	Subscribe     int    `json:"subscribe"`
	Openid        string `json:"openid"`
	Nickname      string `json:"nickname"`
	Sex           int    `json:"sex"`
	Language      string `json:"language"`
	City          string `json:"city"`
	Province      string `json:"province"`
	Country       string `json:"country"`
	Headimgurl    string `json:"headimgurl"`
	SubscribeTime int64  `json:"subscribe_time"`
	Remark        string `json:"remark"`
	Groupid       int    `json:"groupid"`
	TagidList     []int  `json:"tagid_list"`
	Unionid       string `json:"unionid"`
}

STUserInfo STUserInfo

func GetUserInfoToken

func GetUserInfoToken(accessToken, openid string) (userInfo STUserInfo, err error)

GetUserInfoToken GetUserInfo 获取用户信息by user_token

type STUserList

type STUserList struct {
	Total      int `json:"total"`
	Count      int `json:"count"`
	Data       STOpenids
	NextOpenid string `json:"next_openid"`
	Errcode    int    `json:"errcode"`
}

STUserList STUserList

type STVideo

type STVideo struct {
	Title       string `json:"title,omitempty"`
	Mediaid     string `json:"media_id,omitempty"`
	Description string `json:"description,omitempty"`
}

STVideo 视频类

type TACard

type TACard struct {
	CardType      string          `json:"card_type"`
	Groupon       *TGroupon       `json:"groupon,omitempty"`
	Cash          *TCash          `json:"cash,omitempty"`
	Discount      *TDiscount      `json:"discount,omitempty"`
	Gift          *TGift          `json:"gift,omitempty"`
	GeneralCoupon *TGeneralCoupon `json:"generalcoupon,omitempty"`
}

TACard 卡券创建

type TAPPPaySign

type TAPPPaySign struct {
	AppID     string `xml:"appid" json:"appid"`
	Partnerid string `xml:"partnerid" json:"partnerid"`
	Prepayid  string `xml:"prepayid" json:"prepayid"`
	Package   string `xml:"package" json:"package"`
	NonceStr  string `xml:"noncestr" json:"noncestr"`
	Timestamp int64  `xml:"timestamp" json:"timestamp"`
	PaySign   string `xml:"sign" json:"sign"`
}

TAPPPaySign TAPPPaySign

type TAbstract

type TAbstract struct {
	Abstract    string   `json:"abstract,omitempty"`
	IconURLList []string `json:"icon_url_list,omitempty"`
}

TAbstract 封面摘要简介

type TActionInfo

type TActionInfo struct {
	Card         *TScanCard     `json:"card,omitempty"`
	MultipleCard *TMultipleCard `json:"multiple_card,omitempty"`
}

TActionInfo 创建二维码接口参数请求体

type TAdvancedInfo

type TAdvancedInfo struct {
	UseCondition    *TUseCondition   `json:"use_condition,omitempty"`
	Abstract        *TAbstract       `json:"abstract,omitempty"`
	TextImageList   []TTextImageList `json:"text_image_list,omitempty"`
	TimeLimit       []TTimeLimit     `json:"time_limit,omitempty"`
	BusinessService []string         `json:"business_service,omitempty"`
}

TAdvancedInfo 卡券高级信息

type TArticle

type TArticle struct {
	XMLName     xml.Name `xml:"item"`
	Title       string
	Description string
	PicURL      string `xml:"PicUrl" json:"PicUrl"`
	URL         string `xml:"Url" json:"Url"`
}

TArticle 文章类

type TBaseInfo

type TBaseInfo struct {
	Logourl                   string    `json:"logo_url"`
	BrandName                 string    `json:"brand_name"`
	CodeType                  string    `json:"code_type"`
	Title                     string    `json:"title"`
	Color                     string    `json:"color"`
	Notice                    string    `json:"notice"`
	ServicePhone              string    `json:"service_phone,omitempty"`
	Description               string    `json:"description"`
	DateInfo                  TDateInfo `json:"date_info"`
	Sku                       TSku      `json:"sku"`
	UseLimit                  int       `json:"use_limit,omitempty"`
	GetLimit                  int       `json:"get_limit,omitempty"`
	UseCustomCode             bool      `json:"use_custom_code,omitempty"`
	BindOpenid                bool      `json:"ind_openid,omitempty"`
	CanShare                  bool      `json:"can_share,omitempty"`
	CanGiveFriend             bool      `json:"can_give_friend,omitempty"`
	LocationIDList            []int     `json:"location_id_list,omitempty"`
	CenterTitle               string    `json:"center_title,omitempty"`
	CenterSubTitle            string    `json:"center_sub_title,omitempty"`
	CustomAppBrandUserName    string    `json:"custom_app_brand_user_name,omitempty"`
	CustomAppBrandPass        string    `json:"custom_app_brand_pass,omitempty"`
	CenterURL                 string    `json:"center_url,omitempty"`
	CustomURLName             string    `json:"custom_url_name,omitempty"`
	CustomURL                 string    `json:"custom_url,omitempty"`
	CustomURLSubTitle         string    `json:"custom_url_sub_title,omitempty"`
	PromotionAppBrandUserName string    `json:"promotion_app_brand_user_name,omitempty"`
	PromotionAppBrandPass     string    `json:"promotion_app_brand_pass,omitempty"`
	PromotionURLName          string    `json:"promotion_url_name,omitempty"`
	PromotionURL              string    `json:"promotion_url,omitempty"`
	PromotionURLSubTitle      string    `json:"promotion_url_sub_title,omitempty"`
}

TBaseInfo 卡券基础信息字段

type TCash

type TCash struct {
	BaseInfo     TBaseInfo     `json:"base_info"`
	AdvancedInfo TAdvancedInfo `json:"advanced_info"`
	LeastCost    int           `json:"least_cost"`
	ReduceCost   int           `json:"reduce_cost"`
}

TCash 代金券类型

type TDateInfo

type TDateInfo struct {
	Type           string `json:"type"`
	BeginTimestamp int64  `json:"begin_timestamp"`
	EndTimestamp   int64  `json:"end_timestamp,omitempty"`
	FixedTerm      int    `json:"fixed_term,omitempty"`
	FixedBeginTerm int    `json:"fixed_begin_term,omitempty"`
}

TDateInfo 使用日期,有效期的信息。

type TDiscount

type TDiscount struct {
	BaseInfo     TBaseInfo     `json:"base_info"`
	AdvancedInfo TAdvancedInfo `json:"advanced_info"`
	Discount     int           `json:"discount"`
}

TDiscount 折扣券

type TGeneralCoupon

type TGeneralCoupon struct {
	BaseInfo      TBaseInfo     `json:"base_info"`
	AdvancedInfo  TAdvancedInfo `json:"advanced_info"`
	DefaultDetail string        `json:"default_detail"`
}

TGeneralCoupon 优惠券类型

type TGift

type TGift struct {
	BaseInfo     TBaseInfo     `json:"base_info"`
	AdvancedInfo TAdvancedInfo `json:"advanced_info"`
	Gift         string        `json:"gift"`
}

TGift 兑换券类型

type TGroupon

type TGroupon struct {
	BaseInfo     TBaseInfo     `json:"base_info"`
	AdvancedInfo TAdvancedInfo `json:"advanced_info"`
	DealDetail   string        `json:"deal_detail"`
}

TGroupon 团购券类型

type TMaterial

type TMaterial struct {
	Mediaid    string `json:"media_id"`
	Name       string `json:"name,omitempty"`
	UpdateTime int64  `json:"update_time,omitempty"`
	URL        string `json:"url,omitempty"`
}

TMaterial TMaterial

type TMaterialList

type TMaterialList struct {
	TotalCount int         `json:"total_count"`
	ItemCount  int         `json:"item_count"`
	Item       []TMaterial `json:"item"`
	Content    []TNews     `json:"content"`
}

TMaterialList TMaterialList

type TMultipleCard

type TMultipleCard struct {
	CardList []TScanCard `json:"card_list,omitempty"`
}

TMultipleCard TMultipleCard

type TNews

type TNews struct {
	Title            string `json:"title"`
	ThumbMediaid     string `json:"thumb_media_id"`
	Author           string `json:"author"`
	Digest           string `json:"digest"`
	ShowCoverPic     int    `json:"show_cover_pic"`
	Content          string `json:"content"`
	URL              string `json:"url"`
	ContentSourceURL string `json:"content_source_url"`
}

TNews 图文消息

type TNewsContent

type TNewsContent struct {
	NewsItem []TNews `json:"news_item"`
}

TNewsContent TNewsContent

type TNewsItem

type TNewsItem struct {
	Mediaid    string       `json:"media_id"`
	Content    TNewsContent `json:"content"`
	UpdateTime int64        `json:"update_time"`
}

TNewsItem TNewsItem

type TPaySign

type TPaySign struct {
	AppID     string `xml:"appId" json:"appId"`
	Timestamp int64  `xml:"timeStamp" json:"timeStamp"`
	NonceStr  string `xml:"nonceStr" json:"nonceStr"`
	Package   string `xml:"package" json:"package"`
	SignType  string `xml:"signType" json:"signType"`
	PaySign   string `xml:"paySign" json:"paySign"`
}

TPaySign TPaySign

type TScanCard

type TScanCard struct {
	Code          string `json:"code"`
	CardID        string `json:"card_id,omitempty"`
	ExpireSeconds int    `json:"expire_seconds,omitempty"`
	Openid        string `json:"openid,omitempty"`
	IsUniqueCode  bool   `json:"is_unique_code,omitempty"`
	OuterID       int    `json:"outer_id,omitempty"`
	OuterStr      string `json:"outer_str,omitempty"`
}

TScanCard 创建二维码接口参数

type TSku

type TSku struct {
	Quantity int `json:"quantity"`
}

TSku 商品信息

type TTextImageList

type TTextImageList struct {
	ImageURL string `json:"image_url,omitempty"`
	Text     string `json:"text,omitempty"`
}

TTextImageList 图文列表

type TTimeLimit

type TTimeLimit struct {
	Type        string `json:"type,omitempty"`
	BeginHour   int    `json:"begin_hour,omitempty"`
	EndHour     int    `json:"end_hour,omitempty"`
	BeginMinute int    `json:"begin_minute,omitempty"`
	EndMinute   int    `json:"end_minute,omitempty"`
}

TTimeLimit 使用时段限制,包含以下字段

type TUseCondition

type TUseCondition struct {
	AcceptCategory          string `json:"accept_category,omitempty"`
	RejectCategory          string `json:"reject_category,omitempty"`
	CanUseWithOtherDiscount bool   `json:"can_use_with_other_discount,omitempty"`
	LeastCost               int    `json:"least_cost,omitempty"`
	ObjectUseFor            string `json:"object_use_for,omitempty"`
}

TUseCondition //使用门槛

type Template

type Template struct {
	Touser     string                  `json:"touser"`
	Templateid string                  `json:"template_id"`
	URL        string                  `json:"url"`
	Data       map[string]TemplateData `json:"data"`
}

Template Template

type TemplateData

type TemplateData struct {
	Value string `json:"value,omitempty"`
	Color string `json:"color,omitempty"`
}

TemplateData TemplateData

type Wechat

type Wechat struct {
	Appid              string
	Appsecret          string
	Token              string
	Encodingaeskey     string
	AccessToken        string
	AccessTokenExpires int64
	JsapiTicket        string
	JsapiTokenTime     int64
	JsapiTokenExpires  int64
	AuthorizedDomain   string
	Mch                *MchInfo
}

Wechat 微信接口

func New

func New(Appid, Appsecret, Token, Encodingaeskey, AuthorizedDomain string) *Wechat

New 创建wechat

func (*Wechat) AddMaterial

func (wx *Wechat) AddMaterial(mediaType, filepath string) (data ReqMedia, err error)

AddMaterial 增加资源

func (*Wechat) AddNews

func (wx *Wechat) AddNews(news []TNews) (data ReqMedia, err error)

AddNews 增加图文消息

func (*Wechat) AddTempMaterial

func (wx *Wechat) AddTempMaterial(mediaType, filepath string) (data ReqMedia, err error)

AddTempMaterial 增加临时资源

func (*Wechat) BatchTags

func (wx *Wechat) BatchTags(openid []string, tagid int) int

BatchTags 批量为用户打标签

func (*Wechat) CardBatchget

func (wx *Wechat) CardBatchget(statusList []string, offset, count int) (err error)

CardBatchget 批量查询卡券列表

func (*Wechat) CardCodeGet

func (wx *Wechat) CardCodeGet(code string, cardid string, checkConsume bool) (err error)

CardCodeGet 查询Code接口

func (*Wechat) CardCreate

func (wx *Wechat) CardCreate(card TACard) (cardid string, err error)

CardCreate 创建卡券

func (*Wechat) CardGet

func (wx *Wechat) CardGet(cardid string) (err error)

CardGet 查看卡券详情

func (*Wechat) CardMultipleQrcode

func (wx *Wechat) CardMultipleQrcode(cards []TScanCard) (err error)

CardMultipleQrcode 创建二维码接口

func (*Wechat) CardPaycell

func (wx *Wechat) CardPaycell(cardid string, isopen bool) (err error)

CardPaycell 设置买单接口

func (*Wechat) CardSelfconsumecell

func (wx *Wechat) CardSelfconsumecell(cardid string, isopen bool) (err error)

CardSelfconsumecell 设置自助核销接口

func (*Wechat) CardSingleQrcode

func (wx *Wechat) CardSingleQrcode(card TScanCard) (err error)

CardSingleQrcode 创建二维码接口

func (*Wechat) CardUserGetcardlist

func (wx *Wechat) CardUserGetcardlist(openid string, cardid string) (err error)

CardUserGetcardlist 获取用户已领取卡券接口

func (*Wechat) CheckAccessToken

func (wx *Wechat) CheckAccessToken() (err error)

CheckAccessToken 检查微信access_token有效性

func (*Wechat) CheckSignature

func (wx *Wechat) CheckSignature(signature, timestamp, nonce string) bool

CheckSignature 检查微信消息签名

func (*Wechat) CloseOrder

func (wx *Wechat) CloseOrder(outTradeNo string) (data ResCloseOrder, err error)

CloseOrder 关闭订单https://api.mch.weixin.qq.com/pay/closeorder

func (*Wechat) CreatConditionalMenu

func (wx *Wechat) CreatConditionalMenu(menu STCondMenu) (string, error)

CreatConditionalMenu 创建自定义菜单

func (*Wechat) CreatMenu

func (wx *Wechat) CreatMenu(menu STMenu) int

CreatMenu 创建普通菜单

func (*Wechat) CreateAPPPaySign

func (wx *Wechat) CreateAPPPaySign(prepayid string) (data TAPPPaySign)

CreateAPPPaySign 创建APPPaySign

func (*Wechat) CreateJsSignature

func (wx *Wechat) CreateJsSignature(url, noncestr string, timestamp int64, data map[string]interface{}) string

CreateJsSignature 创建jsapi_ticket签名

func (*Wechat) CreatePaySign

func (wx *Wechat) CreatePaySign(prepayid string) (data TPaySign)

CreatePaySign 创建PaySign

func (*Wechat) CreateTag

func (wx *Wechat) CreateTag(name string) (tagid int, err error)

CreateTag 创建用户标签

func (*Wechat) DelMaterial

func (wx *Wechat) DelMaterial(mediaid string) int

DelMaterial 删除资源

func (*Wechat) DelTags

func (wx *Wechat) DelTags(tagid int) (err error)

DelTags 删除用户标签

func (*Wechat) DeleteAllMenu

func (wx *Wechat) DeleteAllMenu() int

DeleteAllMenu 删除所有菜单

func (*Wechat) DeleteConditionalMenu

func (wx *Wechat) DeleteConditionalMenu(menuid string) int

DeleteConditionalMenu 删除自定义菜单

func (*Wechat) Downloadbill

func (wx *Wechat) Downloadbill(billDate string, billType string) (data string, err error)

Downloadbill 下载对账单https://api.mch.weixin.qq.com/pay/downloadbill

func (*Wechat) GetAccessToken

func (wx *Wechat) GetAccessToken() (err error)

GetAccessToken 获取 access_token

func (*Wechat) GetAllMaterials

func (wx *Wechat) GetAllMaterials(Type string) (materials []TMaterial, err error)

GetAllMaterials 获取除文章类型外的资源列表

func (*Wechat) GetAllMaterialsNews

func (wx *Wechat) GetAllMaterialsNews() (materials []TNewsItem, err error)

GetAllMaterialsNews 获取文章类型资源列表

func (*Wechat) GetAllUserInfo

func (wx *Wechat) GetAllUserInfo() (userInfo []STUserInfo, err error)

GetAllUserInfo 获取所有用户的所有信息

func (*Wechat) GetDefaultRedirectUri

func (wx *Wechat) GetDefaultRedirectUri(path, scope, state string) string

GetRedirectUri 获取登录连接

func (*Wechat) GetJsapiTicket

func (wx *Wechat) GetJsapiTicket() (err error)

GetJsapiTicket 获取js的jsapi_ticket

func (*Wechat) GetMaterial

func (wx *Wechat) GetMaterial(basepath, mediaid string) (string, error)

GetMaterial 获取除文章和视频类型外的媒体资源

func (*Wechat) GetMaterials

func (wx *Wechat) GetMaterials(Type string, offset, count int) (data TMaterialList, err error)

GetMaterials 获取资源

func (*Wechat) GetMaterialsNews

func (wx *Wechat) GetMaterialsNews(Type string, offset, count int) (data ResNews, err error)

GetMaterialsNews 获取图文资源

func (*Wechat) GetMenu

func (wx *Wechat) GetMenu() (data STMenus, err error)

GetMenu 获取菜单

func (*Wechat) GetRedirectUri

func (wx *Wechat) GetRedirectUri(uri, scope, state string) string

GetRedirectUri 获取登录连接

func (*Wechat) GetTag

func (wx *Wechat) GetTag() (data []STTag, err error)

GetTag 获取所有用户标签

func (*Wechat) GetTempMaterial

func (wx *Wechat) GetTempMaterial(basepath, mediaid string) (string, error)

GetTempMaterial 获取临时的媒体资源

func (*Wechat) GetUserInfo

func (wx *Wechat) GetUserInfo(openid string) (userInfo STUserInfo, err error)

GetUserInfo 获取用户信息by ac_token

func (*Wechat) GetUserInfoToken

func (wx *Wechat) GetUserInfoToken(accessToken, openid string) (userInfo STUserInfo, err error)

GetUserInfoToken GetUserInfo 获取用户信息by user_token

func (*Wechat) GetUserList

func (wx *Wechat) GetUserList() []string

GetUserList 获取用户openid列表

func (*Wechat) GetUserTags

func (wx *Wechat) GetUserTags(openid string) []int

GetUserTags 获取用户所在标签

func (*Wechat) GetUserToken

func (wx *Wechat) GetUserToken(Code string) (uToken ResUserToken, err error)

GetUserToken 获取用户user_token

func (*Wechat) GetUsers

func (wx *Wechat) GetUsers(openidList []string) (userInfo []STUserInfo, err error)

GetUsers 批量获取用户信息

func (*Wechat) GetUsers100

func (wx *Wechat) GetUsers100(openids []STOpenid) (userInfo []STUserInfo, err error)

GetUsers100 GetUsers100

func (*Wechat) ParseRefundCallBack

func (wx *Wechat) ParseRefundCallBack(reqInfo string) (res *CallBackRefund, err error)

ParseRefundCallBack 解析退款回调信息

func (*Wechat) PreviewMsg

func (wx *Wechat) PreviewMsg(openid, wxname, Msgtype, Content string) int

PreviewMsg https://api.weixin.qq.com/cgi-bin/message/mass/preview?access_token=ACCESS_TOKEN

func (*Wechat) QueryOrder

func (wx *Wechat) QueryOrder(transactionid, outTradeNo string) (data ResQueryOrder, err error)

QueryOrder 查询订单https://api.mch.weixin.qq.com/pay/orderquery

func (*Wechat) Refund

func (wx *Wechat) Refund(refund ReqRefund) (data ResRefund, err error)

Refund 申请退款https://api.mch.weixin.qq.com/secapi/pay/refund

func (*Wechat) RefundQuery

func (wx *Wechat) RefundQuery(refund ReqRefundquery) (data ResReqRefundquery, err error)

RefundQuery 申请退款查询https://api.mch.weixin.qq.com/pay/refundquery

func (*Wechat) SendAll

func (wx *Wechat) SendAll(Tagid int, Msgtype, Content string) (sendData ResMsg, err error)

SendAll https://api.weixin.qq.com/cgi-bin/message/mass/sendall?access_token=ACCESS_TOKEN

func (*Wechat) SendHongbao

func (wx *Wechat) SendHongbao(hb ReqHongbao) (resp ResHongbao, err error)

SendHongbao 发送红包

func (*Wechat) SendList

func (wx *Wechat) SendList(userList []string, Msgtype, Content string) (sendData ResMsg, err error)

SendList https://api.weixin.qq.com/cgi-bin/message/mass/send?access_token=ACCESS_TOKEN

func (*Wechat) SendMsg

func (wx *Wechat) SendMsg(data interface{}) int

SendMsg https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN

func (*Wechat) SendTemplate

func (wx *Wechat) SendTemplate(data string) (string, error)

SendTemplate 发送模板消息https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN

func (*Wechat) SendTemplateToUser

func (wx *Wechat) SendTemplateToUser(touser, templateid, url string,
	data map[string]TemplateData) (string, error)

SendTemplateToUser 发送模板消息到用户

func (*Wechat) SetMch

func (wx *Wechat) SetMch(mchid, paykey, certpath, keypath, capath string) (err error)

SetMch 设置商户

func (*Wechat) UnBatchTags

func (wx *Wechat) UnBatchTags(openid []string, tagid int) int

UnBatchTags 批量取消用户标签

func (*Wechat) UnifiedOrder

func (wx *Wechat) UnifiedOrder(order ReqUnifiedOrder) (data ResUnifiedOrder, err error)

UnifiedOrder 支付下单https://api.mch.weixin.qq.com/pay/unifiedorder

func (*Wechat) UpdateNews

func (wx *Wechat) UpdateNews(Mediaid string, Index int, news TNews) int

UpdateNews 修改图文消息

func (*Wechat) UpdateRemark

func (wx *Wechat) UpdateRemark(openid, remark string) int

UpdateRemark 设置备注名

func (*Wechat) UpdateTag

func (wx *Wechat) UpdateTag(tagid int, name string) (err error)

UpdateTag 更新用户标签名

func (*Wechat) UploadImg

func (wx *Wechat) UploadImg(filepath string) (data ReqMedia, err error)

UploadImg 增加图文消息图片

Jump to

Keyboard shortcuts

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