wechat

package
v0.0.0-...-34dd132 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TokenExpires token expires time 1 hours
	TokenExpires = 90 * 60
	// TicketExpires ticket expires time 1 hours
	TicketExpires = 60 * 60

	// BaseURL api host
	BaseURL = `https://api.weixin.qq.com`
	// OpenURL open host
	OpenURL = `https://open.weixin.qq.com`

	// PayHost pay base host
	PayHost = `https://api.mch.weixin.qq.com`

	// ErrReqOk request ok
	ErrReqOk = 0

	// PayURLUnifiedOrder pay 付款
	PayURLUnifiedOrder = `/pay/unifiedorder`
	// PayURLPayRefund pay refund 退款
	PayURLPayRefund = `/secapi/pay/refund`
	// PayURLPapPay 委托代扣申请扣款
	PayURLPapPay = `/pay/pappayapply`
	// PayURLPapayEntrust H5 纯签约
	PayURLPapayEntrust = `/papay/h5entrustweb`

	// PayTradeTypeJS JSAPI 公众号支付
	PayTradeTypeJS = `JSAPI`
	// PayTradeTypeNative NATIVE 扫码支付
	PayTradeTypeNative = `NATIVE`
	// PayTradeTypeAPP APP APP支付
	PayTradeTypeAPP = `APP`

	// MsgText text message
	MsgText = `text`
	// MsgImage image message
	MsgImage = `image`
	// MsgVoice voice message
	MsgVoice = `voice`
	// MsgVideo video message
	MsgVideo = `video`
	// MsgShortVideo shortvideo message
	MsgShortVideo = `shortvideo`
	// MsgLocation location message
	MsgLocation = `location`
	// MsgLink link message
	MsgLink = `link`

	// MsgNews news
	MsgNews = `news`
	// MsgMusic music
	MsgMusic = `music`

	// MsgEvent event
	MsgEvent = `event`

	// MsgEventSubscribe subscribe 订阅
	MsgEventSubscribe = `subscribe`
	// MsgEventUnSubscribe unsubscribe 取消订阅
	MsgEventUnSubscribe = `unsubscribe`

	// MsgEventSCAN 已关注用户扫码事件
	MsgEventSCAN = `SCAN`

	// MsgEventLOCATION 上报地理位置事件
	MsgEventLOCATION = `LOCATION`
	// MsgEventCLICK 自定义菜单点击事件
	MsgEventCLICK = `CLICK`

	// MsgEventVIEW 点击自定义菜单跳转链接时的事件
	MsgEventVIEW = `VIEW`

	// MsgEventTEMPLATESENDJOBFINISH 模版消息发送任务结果事件
	MsgEventTEMPLATESENDJOBFINISH = `TEMPLATESENDJOBFINISH`
)

Variables

This section is empty.

Functions

func Random

func Random(n int) string

Random 指定长度的随机字符串(字母或数字)

func Sign

func Sign(req map[string]interface{}, key string) (sign string)

Sign 微信计算签名的函数

Types

type ArticleItem

type ArticleItem struct {
	Title       string `xml:"Title" json:"Title"`
	Description string `xml:"Description" json:"Description"`
	PicURL      string `xml:"PicUrl" json:"PicUrl"`
	URL         string `xml:"Url" json:"Url"`
}

ArticleItem article item

type Client

type Client struct {
	AppID          string `json:"appid"`
	AppSecret      string `json:"appsecret"`
	Token          string `json:"token"`
	EncodingAESKey string `json:"encodingaeskey"`

	//ReadLock *sync.Mutex
	UseCacheToken bool

	AccessToken    string
	LastTokenTime  int64
	TokenFromCache bool

	Ticket         string
	LastTicketTime int64
}

Client wechat

func NewClient

func NewClient(appID, appSecret, token, encodingAESKey string) *Client

NewClient new client

func (Client) CreateMenu

func (wc Client) CreateMenu(menu FormMenu) (err error)

CreateMenu 创建自定义菜单

func (Client) GetCodeURL

func (wc Client) GetCodeURL(redirectURL, state string) (uri string)

GetCodeURL get code 授权获取 OpenID URL(静默授权) /connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect 转向到 redirect_uri/?code=CODE&state=STATE

func (Client) GetMaterial

func (wc Client) GetMaterial(mtype string, offset, count int) (material Material, err error)

GetMaterial 永久资料

func (Client) GetMenu

func (wc Client) GetMenu() (menu Menu, err error)

GetMenu 查询自定义菜单

func (Client) GetOpenID

func (wc Client) GetOpenID(code string) (jq *myth.JSONQuery, err error)

GetOpenID 获取 OpenID /sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code

func (Client) GetSignPackage

func (wc Client) GetSignPackage(uri, nonceStr string) (sign SignPackage, err error)

GetSignPackage JS 签名

uri      当前 URL
nonceStr 随机字符串

func (Client) GetUserInfo

func (wc Client) GetUserInfo(openid string) (info UserInfo, err error)

GetUserInfo user info

func (Client) GetUserInfoCodeURL

func (wc Client) GetUserInfoCodeURL(redirectURL, state string) (uri string)

GetUserInfoCodeURL get code 授权获取 OpenID URL /connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect 转向到 redirect_uri/?code=CODE&state=STATE

func (Client) GetUserList

func (wc Client) GetUserList(nextOpenID string) (list UserList, err error)

GetUserList user list

func (Client) SendTemplateMessage

func (wc Client) SendTemplateMessage(template TemplateMessage) (res TemplateResponse, err error)

SendTemplateMessage send template message POST /cgi-bin/message/template/send?access_token=ACCESS_TOKEN

func (Client) SendTemplateMessageX

func (wc Client) SendTemplateMessageX(data []byte) (res TemplateResponse, err error)

SendTemplateMessageX 发送自定义模版消息

func (Client) TemplateMessageReslut

func (wc Client) TemplateMessageReslut(jq *myth.JSONQuery) (code int, id int64, err error)

TemplateMessageReslut template message reslut

func (*Client) TokenUseCache

func (wc *Client) TokenUseCache(ok bool)

TokenUseCache token from cache

type ClientToken

type ClientToken struct {
	AppID         string `json:"appid"`
	AccessToken   string `json:"access_token"`
	LastTokenTime int64  `json:"last_token_time"`
}

ClientToken wechat client token

type EventTemplateReply

type EventTemplateReply struct {
	XMLName      xml.Name `xml:"xml"`
	ToUserName   string   `xml:"ToUserName"`
	FromUserName string   `xml:"FromUserName"`
	CreateTime   string   `xml:"CreateTime"`
	MsgType      string   `xml:"MsgType"`
	Event        string   `xml:"Event"`
	MsgID        string   `xml:"MsgID"`
	Status       string   `xml:"Status"`
}

EventTemplateReply event reply

type FormAuthorize

type FormAuthorize struct {
	Code  string `form:"code"`
	State string `form:"state"`
	URL   string `form:"url"`
}

FormAuthorize get code

type FormCode

type FormCode struct {
	Code string `form:"code" json:"code"`
}

FormCode code

type FormMaterial

type FormMaterial struct {
	Type   string `form:"type"`
	Offset int    `form:"offset"`
	Count  int    `form:"count"`
}

FormMaterial Material

type FormMenu

type FormMenu struct {
	Button []*FormMenuButton `json:"button"`
}

FormMenu menu create

type FormMenuButton

type FormMenuButton struct {
	Type      string            `json:"type,omitempty"`
	Name      string            `json:"name"`
	Key       string            `json:"key,omitempty"`
	URL       string            `json:"url,omitempty"`
	AppID     string            `json:"appid,omitempty"`
	Pagepath  string            `json:"pagepath,omitempty"`
	MediaID   string            `json:"media_id,omitempty"`
	SubButton []*FormMenuButton `json:"sub_button,omitempty"`
}

FormMenuButton menu button

type FormNextOpenID

type FormNextOpenID struct {
	Next string `form:"next_openid"`
}

FormNextOpenID next openid

type FormOpenID

type FormOpenID struct {
	OpenID string `form:"openid"`
}

FormOpenID openid

type FormPayNotify

type FormPayNotify struct {
	XMLName  xml.Name `xml:"xml" json:"_,omitempty"`
	AppID    string   `form:"appid" xml:"appid"`
	Attach   string   `form:"attach" xml:"attach"`
	BankType string   `form:"bank_type" xml:"bank_type"`
	CashFee  int      `form:"cash_fee" xml:"cash_fee"`
	FeeType  string   `form:"fee_type" xml:"fee_type"`

	MchID       string `form:"mch_id" xml:"mch_id"`
	IsSubscribe string `form:"is_subscribe" xml:"is_subscribe"`
	NonceStr    string `form:"nonce_str" xml:"nonce_str"`
	OpenID      string `form:"openid" xml:"openid"`
	OutTradeNo  string `form:"out_trade_no" xml:"out_trade_no"`

	ResultCode string `form:"result_code" xml:"result_code"`
	ReturnMsg  string `form:"return_msg" xml:"return_msg"`
	ReturnCode string `form:"return_code" xml:"return_code"`
	ErrCodeDes string `form:"err_code_des" xml:"err_code_des"`
	ErrCode    string `form:"err_code" xml:"err_code"`

	Sign     string `form:"sign" xml:"sign"`
	TimeEnd  string `form:"time_end" xml:"time_end"`
	TotalFee int    `form:"total_fee" xml:"total_fee"`

	TradeType     string `form:"trade_type" xml:"trade_type"`
	TransactionID string `form:"transaction_id" xml:"transaction_id"`
	ContractID    string `form:"contract_id" xml:"contract_id"`
}

FormPayNotify notify

type FormSignPackage

type FormSignPackage struct {
	URL string `form:"url"`
}

FormSignPackage js sign package

type FormSignature

type FormSignature struct {
	TimeStamp string `form:"timestamp" json:"timestamp"`
	Nonce     string `form:"nonce" json:"nonce"`
	Signature string `form:"signature" json:"signature"`
	Echostr   string `form:"echostr" json:"echostr"`
}

FormSignature signature

type FormURLState

type FormURLState struct {
	RedirectURL string `form:"url" json:"url" xml:"url"`
	State       string `form:"state" json:"state" xml:"state"`
}

FormURLState redirect url and state

type List

type List struct {
	OpenID []string `json:"openid"`
}

List openid list

type Material

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

Material 素材

type MaterialContent

type MaterialContent struct {
	NewsItem   []*MaterialNewsItem `json:"news_item,omitempty"`
	CreateTime int                 `json:"create_time,omitempty"`
	UpdateTime int                 `json:"update_time,omitempty"`
}

MaterialContent 素材内容

type MaterialItem

type MaterialItem struct {
	MediaID    string           `json:"media_id"`
	Name       string           `json:"name,omitempty"`
	UpdateTime int              `json:"update_time"`
	URL        string           `json:"url,omitempty"`
	Content    *MaterialContent `json:"content,omitempty"`
}

MaterialItem 素材信息

type MaterialNewsItem

type MaterialNewsItem struct {
	Title              string `json:"title"`
	Author             string `json:"author"`
	Digest             string `json:"digest"`
	Content            string `json:"content"`
	ContentSourceURL   string `json:"content_source_url"`
	ThumbMediaID       string `json:"thumb_media_id"`
	ShowCoverPic       int    `json:"show_cover_pic"`
	URL                string `json:"url"`
	ThumbURL           string `json:"thumb_url"`
	NeedOpenComment    int    `json:"need_open_comment"`
	OnlyFansCanComment int    `json:"only_fans_can_comment"`
}

MaterialNewsItem 图片素材

type Menu struct {
	IsOpen int64    `json:"is_menu_open"`
	Info   menuInfo `json:"selfmenu_info"`
}

Menu menu

type Message

type Message struct {
	XMLName      xml.Name `xml:"xml"`
	ToUserName   string   `xml:"ToUserName" json:"ToUserName"`
	FromUserName string   `xml:"FromUserName" json:"FromUserName"`
	CreateTime   int64    `xml:"CreateTime" json:"CreateTime"`
	MsgType      string   `xml:"MsgType" json:"MsgType"` // text/image/voice/video/shortvideo/location/link

	// 文本 Text Text message
	Text string `xml:"Content,omitempty" json:"Content,omitempty"`

	// 图片 PicURL / MediaID image messgae
	PicURL string `xml:"PicUrl,omitempty" json:"PicUrl,omitempty"`
	// MediaID 媒体
	MediaID string `xml:"MediaId,omitempty" json:"MediaId,omitempty"`
	// 语音 MediaID / Format voice message
	Format string `xml:"Format,omitempty" json:"Format,omitempty"`
	// 视频/小视频 ThumbMediaID / MediaID video/shortvideo message
	ThumbMediaID string `xml:"ThumbMediaId,omitempty" json:"ThumbMediaId,omitempty"`

	// 地理位置 location message
	LocationX string `xml:"Location_X,omitempty" json:"Location_X,omitempty"` // 纬度
	LocationY string `xml:"Location_Y,omitempty" json:"Location_Y,omitempty"` // 经度
	Scale     string `xml:"Scale,omitempty" json:"Scale,omitempty"`           // 地图缩放大小
	Label     string `xml:"Label,omitempty" json:"Label,omitempty"`           // 地理位置信息

	// 链接消息 link
	Title       string `xml:"Title,omitempty" json:"Title,omitempty"`             // 消息标题
	Description string `xml:"Description,omitempty" json:"Description,omitempty"` // 消息描述
	URL         string `xml:"Url,omitempty" json:"Url,omitempty"`                 // 消息链接

	Event string `xml:"Event,omitempty" json:"Event,omitempty"` // 事件 subscribe(订阅)、unsubscribe(取消订阅)、CLICK(自定义菜单事件)、SCAN

	// 扫描带参数二维码事件
	EventKey string `xml:"EventKey,omitempty" json:"EventKey,omitempty"` // 事件KEY 值,扫码未关注的 qrscene_ 为前缀(subscribe 事件, 已关注的推送 SCAN 事件),后面为二维码的参数值, 自定义菜单事件与自定义菜单接口中 KEY 值对应
	Ticket   string `xml:"Ticket,omitempty" json:"Ticket,omitempty"`     // 二维码的ticket,可用来换取二维码图片

	// 地理位置 location message
	Latitude  string `xml:"Latitude,omitempty" json:"Latitude,omitempty"`   // 纬度
	Longitude string `xml:"Longitude,omitempty" json:"Longitude,omitempty"` // 经度
	Precision string `xml:"Precision,omitempty" json:"Precision,omitempty"` // 地理位置精度

	MsgID  int64  `xml:"MsgID,omitempty" json:"MsgID,omitempty"`   // 消息id
	Status string `xml:"Status,omitempty" json:"Status,omitempty"` // 消息发送状态
}

Message message

type MiniClient

type MiniClient struct {
	AppID     string `json:"appid"`
	AppSecret string `json:"appsecret"`

	AccessToken   string
	LastTokenTime int64
}

MiniClient wechat mini

func NewMiniClient

func NewMiniClient(appID, appSecret string) *MiniClient

NewMiniClient new mini client

func (*MiniClient) GetMiniOpenID

func (mc *MiniClient) GetMiniOpenID(frm FormCode) (s MiniSession, err error)

GetMiniOpenID get openid by code

func (*MiniClient) GetPhoneInfo

func (mc *MiniClient) GetPhoneInfo(frm FormCode) (res MiniPhoneInfo, err error)

GetPhoneInfo 获取手机信息 /wxa/business/getuserphonenumber

func (*MiniClient) TemplateList

func (mc *MiniClient) TemplateList(offset, count int) (body []byte, err error)

TemplateList /cgi-bin/wxopen/template/list

func (*MiniClient) TemplateSend

func (mc *MiniClient) TemplateSend(template MiniTemplateMessage) (jq *myth.JSONQuery, err error)

TemplateSend /cgi-bin/message/wxopen/template/send

func (*MiniClient) UniformSend

func (mc *MiniClient) UniformSend(template MiniUniformMessage) (jq *myth.JSONQuery, err error)

UniformSend /cgi-bin/message/wxopen/template/uniform_send

type MiniPhoneInfo

type MiniPhoneInfo struct {
	ResponseMsg
	PhoneInfo struct {
		PhoneNumber     string `json:"phoneNumber"`
		PurePhoneNumber string `json:"purePhoneNumber"`
		CountryCode     string `json:"countryCode"`
		Watermark       struct {
			Timestamp int64  `json:"timestamp"`
			AppID     string `json:"appid"`
		} `json:"watermark"`
	} `json:"phone_info"`
}

MiniPhoneInfo 手机信息

type MiniProgramPage

type MiniProgramPage struct {
	AppID    string `json:"appid,omitempty"`
	PagePath string `json:"pagepath,omitempty"`
}

MiniProgramPage mini

type MiniSession

type MiniSession struct {
	OpenID     string `json:"openid"`
	SessionKey string `json:"session_key"`
	UnionID    string `json:"unionid"`
}

MiniSession mini session

type MiniTemplateMessage

type MiniTemplateMessage struct {
	ToUser     string       `json:"touser"`
	TemplateID string       `json:"template_id"`
	Page       string       `json:"page"`
	FormID     string       `json:"form_id"`
	Data       TemplateData `json:"data"`
}

MiniTemplateMessage mini template message

type MiniUniformMessage

type MiniUniformMessage struct {
	ToUser string                `json:"touser"`
	WeApp  *WeappTemplateMessage `json:"weapp_template_msg,omitempty"`
	MP     *MpTemplateMessage    `json:"mp_template_msg,omitempty"`
}

MiniUniformMessage mini uniform send

type MpTemplateMessage

type MpTemplateMessage struct {
	AppID      string          `json:"appid"`
	TemplateID string          `json:"template_id"`
	URL        string          `json:"url"`
	Mini       MiniProgramPage `json:"miniprogram"`
	Data       TemplateData    `json:"data"`
}

MpTemplateMessage wechat public message

type PayConfig

type PayConfig struct {
	AppID      string `json:"appid"`
	MchID      string `json:"mchid"`
	Key        string `json:"key"`
	AppSecret  string `json:"appsecret"`
	SSLCert    string `json:"sslcert"`
	SSLKey     string `json:"sslkey"`
	ContractID string `json:"contractid"`
	NotifyURL  string `json:"notify_url"`
}

PayConfig WeChat pay configure

type PayOrderQuery

type PayOrderQuery struct {
	XMLName       xml.Name `xml:"xml"`
	AppID         string   `xml:"appid"`
	MchID         string   `xml:"mch_id"`
	NonceStr      string   `xml:"nonce_str"`
	TransactionID string   `xml:"transaction_id,omitempty"`
	OutTradeNo    string   `xml:"out_trade_no,omitempty"`
	Sign          string   `xml:"sign"`
}

PayOrderQuery https://api.mch.weixin.qq.com/pay/orderquery

type PayReply

type PayReply struct {
	XMLName        xml.Name `xml:"xml" json:"_,omitempty"`
	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"`
	PrePayID       string   `xml:"prepay_id"`
	TradeType      string   `xml:"trade_type"`
	URL            string   `xml:"code_url"`
	ErrCode        string   `xml:"err_code"`
	ErrCodeDes     string   `xml:"err_code_des"`
	OpenID         string   `xml:"openid"`
	Attach         string   `xml:"attach"`
	IsSubscribe    string   `xml:"is_subscribe"`
	BankType       string   `xml:"bank_type"`
	CashFee        string   `xml:"cash_fee"`
	FeeType        string   `xml:"fee_type"`
	OutTradeNo     string   `xml:"out_trade_no"`
	TimeEnd        string   `xml:"time_end"`
	TotalFee       string   `xml:"total_fee"`
	TradeState     string   `xml:"trade_state"`
	TradeStateDesc string   `xml:"trade_state_desc"`
	TransactionID  string   `xml:"transaction_id"`
	ContractID     string   `form:"contract_id" xml:"contract_id"`
}

PayReply pay reply

func PayQuery

func PayQuery(cpyid int, config PayConfig, order PayOrderQuery) (reply PayReply, err error)

PayQuery order query 订单查询

type PayUnifiedOrder

type PayUnifiedOrder struct {
	XMLName        xml.Name `xml:"xml"`
	AppID          string   `xml:"appid"`
	MchID          string   `xml:"mch_id"`
	Body           string   `xml:"body"`
	NonceStr       string   `xml:"nonce_str"`
	NotifyURL      string   `xml:"notify_url"`
	TradeType      string   `xml:"trade_type"`
	OpenID         string   `xml:"openid"`
	SpbillCreateIP string   `xml:"spbill_create_ip"`
	TimeStart      string   `xml:"time_start"`
	TotalFee       int      `xml:"total_fee"`
	OutTradeNo     string   `xml:"out_trade_no"`
	Attach         string   `xml:"attach"`
	Sign           string   `xml:"sign"`
}

PayUnifiedOrder https://api.mch.weixin.qq.com/pay/unifiedorder

type ReplyMessage

type ReplyMessage struct {
	XMLName      xml.Name `xml:"xml"`
	ToUserName   string   `xml:"ToUserName" json:"ToUserName"`
	FromUserName string   `xml:"FromUserName" json:"FromUserName"`
	CreateTime   int64    `xml:"CreateTime" json:"CreateTime"`
	MsgType      string   `xml:"MsgType" json:"MsgType"` // text/image/voice/video/music/news

	// 文本 Content Text message
	Content string `xml:"Content,omitempty" json:"Content,omitempty"`

	// image
	ArticleCount int           `xml:"ArticleCount,omitempty" json:"ArticleCount,omitempty"`
	Articles     *articleItems `xml:"Articles,omitempty" json:"Articles,omitempty"`
}

ReplyMessage reply message

func ReplyNews

func ReplyNews(msg Message, items []ArticleItem) (reply ReplyMessage)

ReplyNews 回复图文信息

func ReplyText

func ReplyText(msg Message, text string) (reply ReplyMessage)

ReplyText 回复文本信息

func (ReplyMessage) ToXML

func (m ReplyMessage) ToXML() (data []byte, err error)

ToXML reply message to xml

type ResponseMsg

type ResponseMsg struct {
	ErrCode int    `json:"errcode"`
	ErrMsg  string `json:"errmsg"`
}

ResponseMsg response

type Server

type Server struct {
	AppID          string `json:"appid"`
	AppSecret      string `json:"appsecret"`
	Token          string `json:"token"`
	EncodingAESKey string `json:"encodingaeskey"`
}

Server wechat

func NewServer

func NewServer(appID, appSecret, token, encodingAESKey string) *Server

NewServer new Server

func (Server) Echo

func (ws Server) Echo(s FormSignature) (data string, err error)

Echo notify echo GET

func (Server) Validate

func (ws Server) Validate(signature, timestamp, nonce string) bool

Validate 验证请求合法性

type SignPackage

type SignPackage struct {
	AppID     string `json:"appId"`
	NonceStr  string `json:"nonceStr"`
	Timestamp int64  `json:"timestamp"`
	Signature string `json:"signature"`
	Ticket    string `json:"ticket"`
	URL       string `json:"url"`
}

SignPackage sign package

type TemplateData

type TemplateData struct {
	First     *ValueColor `json:"first"`
	Keyword1  *ValueColor `json:"keyword1,omitempty"`
	Keyword2  *ValueColor `json:"keyword2,omitempty"`
	Keyword3  *ValueColor `json:"keyword3,omitempty"`
	Keyword4  *ValueColor `json:"keyword4,omitempty"`
	Keyword5  *ValueColor `json:"keyword5,omitempty"`
	Keyword6  *ValueColor `json:"keyword6,omitempty"`
	Keyword7  *ValueColor `json:"keyword7,omitempty"`
	Keyword8  *ValueColor `json:"keyword8,omitempty"`
	Keyword9  *ValueColor `json:"keyword9,omitempty"`
	Keyword10 *ValueColor `json:"keyword10,omitempty"`
	Name      *ValueColor `json:"name,omitempty"`
	ExpDate   *ValueColor `json:"expDate,omitempty"`
	Remark    *ValueColor `json:"remark,omitempty"`
}

TemplateData data

type TemplateMessage

type TemplateMessage struct {
	ToUser      string           `json:"touser"`
	TemplateID  string           `json:"template_id"`
	URL         string           `json:"url"`
	MiniProgram *MiniProgramPage `json:"miniprogram,omitempty"`
	Data        TemplateData     `json:"data"`
}

TemplateMessage template message

type TemplateResponse

type TemplateResponse struct {
	ResponseMsg
	MessageID int64 `json:"msgid"`
}

TemplateResponse 模版消息返回

type UserInfo

type UserInfo 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  int    `json:"subscribe_time"`
	UnionID        string `json:"unionid"`
	Remark         string `json:"remark"`
	GroupID        int    `json:"groupid"`
	TagidList      []int  `json:"tagid_list"`
	SubscribeScene string `json:"subscribe_scene"`
	QrScene        int    `json:"qr_scene"`
	QrSceneStr     string `json:"qr_scene_str"`
}

UserInfo userinfo

type UserList

type UserList struct {
	Total      int    `json:"total"`
	Count      int    `json:"count"`
	Data       List   `json:"data"`
	NextOpenID string `json:"next_openid"`
}

UserList user list

type ValueColor

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

ValueColor value color

type WeappTemplateMessage

type WeappTemplateMessage struct {
	TemplateID string       `json:"template_id"`
	Page       string       `json:"page"`
	FormID     string       `json:"form_id"`
	Data       TemplateData `json:"data"`
	Emphasis   string       `json:"emphasis_keyword"`
}

WeappTemplateMessage mini message

type WepayResponseDetail

type WepayResponseDetail struct {
	Field    string `json:"field"`
	Value    string `json:"value"`
	Issue    string `json:"issue"`
	Location string `json:"location"`
}

WepayResponseDetail detail

type WepayResponseMessageV3

type WepayResponseMessageV3 struct {
	Code    string              `json:"code"`
	Message string              `json:"message"`
	Detail  WepayResponseDetail `json:"detail"`
}

WepayResponseMessageV3 v3 返回消息头

Jump to

Keyboard shortcuts

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