Documentation ¶
Index ¶
- Constants
- Variables
- func BytesOrderToNumber(orderBytes []byte) int
- func GetCurrTs() int64
- func HTTPGet(uri string) ([]byte, error)
- func NumberToBytesOrder(number int) []byte
- func PKCS7Padding(ciphertext []byte, blockSize int) []byte
- func PKCS7UnPadding(plantText []byte, blockSize int) []byte
- func RandomStr(length int) string
- func Signature(params ...string) string
- type AES
- type BaseEncrypt
- func (this *BaseEncrypt) DecryptInputMsg(msg_signature, timestamp, nonce string, postdata WxEncryptInputMessage) (int, string)
- func (this *BaseEncrypt) EncryptMsg(replyMsg, nonce, timestamp string) (int, string)
- func (this *BaseEncrypt) Init(token, appid, aeskey string)
- func (this *BaseEncrypt) VerifyURL(msg_signature, echostr string, paramters ...string) bool
- type JsSigner
- type ResAccessToken
- type WxApplication
- type WxArticleMsg
- type WxEncryptInputMessage
- type WxEncryptOutputMessage
- type WxImageMsg
- type WxMessage
- type WxMessageBody
- type WxMusicMsg
- type WxRequest
- type WxResponse
- type WxTextMsg
- type WxVideoMsg
- type WxVoiceMsg
Constants ¶
View Source
const ( EVENT_SUB = "subscribe" //订阅 EVENT_UNSUB = "unsubscribe" //取消订阅 EVENT_SCAN = "SCAN" //扫描 EVENT_LOCATION = "LOCATION" //地址 EVENT_CLICK = "CLICK" //点击 EVENT_VIEW = "VIEW" //跳转 //消息类型 MSGTYPE_TEXT = "text" MSGTYPE_IMAGE = "image" MSGTYPE_VIDEO = "video" MSGTYPE_SHORT_VIDEO = "shortvideo" MSGTYPE_VOICE = "voice" MSGTYPE_LOCATION = "location" MSGTYPE_LINK = "link" MSGTYPE_EVENT = "event" )
事件类型
View Source
const ( Text = "text" Location = "location" Image = "image" Link = "link" Event = "event" Music = "music" News = "news" Voice = "voice" Video = "video" )
View Source
const AccessTokenURL = "https://api.weixin.qq.com/cgi-bin/token"
Variables ¶
View Source
var (
CHARS []byte = []byte("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
)
Functions ¶
func NumberToBytesOrder ¶
---------------协议算法------------------// 生成4个字节的网络字节序
func PKCS7Padding ¶
---------------------------PKCS7-----------------------------//
func PKCS7UnPadding ¶
Types ¶
type BaseEncrypt ¶
type BaseEncrypt struct {
// contains filtered or unexported fields
}
Encrypt
func (*BaseEncrypt) DecryptInputMsg ¶
func (this *BaseEncrypt) DecryptInputMsg(msg_signature, timestamp, nonce string, postdata WxEncryptInputMessage) (int, string)
机密消息
func (*BaseEncrypt) EncryptMsg ¶
func (this *BaseEncrypt) EncryptMsg(replyMsg, nonce, timestamp string) (int, string)
加密消息
func (*BaseEncrypt) Init ¶
func (this *BaseEncrypt) Init(token, appid, aeskey string)
type JsSigner ¶
type JsSigner struct { mvc.SimpleController App *WxApplication DefaultStr string }
func (*JsSigner) Get ¶
func (this *JsSigner) Get(c mvc.Context, p interface{}) (interface{}, mvc.BingoError)
func (*JsSigner) GetParameType ¶
type ResAccessToken ¶
type ResAccessToken struct { AccessToken string `json:"access_token"` ExpiresIn int64 `json:"expires_in"` // contains filtered or unexported fields }
ResAccessToken struct
type WxApplication ¶
func (*WxApplication) GetAccessToken ¶
func (this *WxApplication) GetAccessToken() (accessToken string, err error)
func (*WxApplication) GetAccessTokenFromServer ¶
func (this *WxApplication) GetAccessTokenFromServer() (resAccessToken ResAccessToken, err error)
GetAccessTokenFromServer 强制从微信服务器获取token
func (*WxApplication) GetTicket ¶
func (this *WxApplication) GetTicket() (ticketStr string, err error)
GetTicket 获取jsapi_tocket
type WxArticleMsg ¶
type WxArticleMsg struct { ArticleCount int `xml:",omitempty"` Articles []*articleItem `xml:"Articles>item,omitempty"` // contains filtered or unexported fields }
func (*WxArticleMsg) AddArticle ¶
func (this *WxArticleMsg) AddArticle(title, desc, picurl, url string)
func (*WxArticleMsg) Init ¶
func (this *WxArticleMsg) Init(w *WxMessageBody)
type WxEncryptInputMessage ¶
type WxEncryptInputMessage struct { XMLName xml.Name `xml:"xml"` ToUserName string AppId string Encrypt string }
输入的加密消息
type WxEncryptOutputMessage ¶
type WxEncryptOutputMessage struct { XMLName xml.Name `xml:"xml"` Encrypt string MsgSignature string TimeStamp string Nonce string }
输出的加密消息
type WxImageMsg ¶
type WxImageMsg struct { Image string `xml:"Image>MediaId"` // contains filtered or unexported fields }
func (*WxImageMsg) Init ¶
func (this *WxImageMsg) Init(w *WxMessageBody)
func (*WxImageMsg) SetBody ¶
func (this *WxImageMsg) SetBody(image string)
type WxMessage ¶
type WxMessage struct { WxRequest // contains filtered or unexported fields }
func (*WxMessage) GetDataType ¶
type WxMessageBody ¶
type WxMessageBody struct { XMLName xml.Name `xml:"xml"` Content string //文本内容 Event string //当类型为Event时候有值,事件类型:subscribe(订阅)、unsubscribe(取消订阅)、自定义菜单事件CLICK、上报位置LOCATION、用户已关注时的事件推送SCAN、菜单跳转VIEW EventKey string //CLICK事件KEY值,与自定义菜单接口中KEY值对应 //为通过二维码订阅的时候事件为subscribe事件KEY值,qrscene_为前缀,后面为二维码的参数值 Ticket string //二维码的ticket,可用来换取二维码图片 Latitude float32 //LOCATION地理位置纬度 Longitude float32 //LOCATION地理位置经度 Precision float32 //LOCATION地理位置精度 Location_X, Location_Y float32 //地理位置维度,地理位置经度 Scale int //地图缩放大小 Label string //地理位置信息 PicUrl string //图片地址 Format string //语音格式,如amr,speex等 Recognition string //语音识别结果,UTF8编码 MediaId string //图片消息媒体id,可以调用多媒体文件下载接口拉取数据。 ThumbMediaId string //视频消息缩略图的媒体id,可以调用多媒体文件下载接口拉取数据。 Title string //link消息标题 Description string //link消息描述 Url string //link消息链接 MsgId int //消息id,64位整型 // contains filtered or unexported fields }
type WxMusicMsg ¶
type WxMusicMsg struct { Music music // contains filtered or unexported fields }
func (*WxMusicMsg) Init ¶
func (this *WxMusicMsg) Init(w *WxMessageBody)
func (*WxMusicMsg) SetBody ¶
func (this *WxMusicMsg) SetBody(title, desc, murl, hqurl, mediaid string)
type WxResponse ¶
type WxResponse struct {
// contains filtered or unexported fields
}
type WxTextMsg ¶
type WxTextMsg struct { Content string // contains filtered or unexported fields }
func (*WxTextMsg) Init ¶
func (this *WxTextMsg) Init(w *WxMessageBody)
type WxVideoMsg ¶
type WxVideoMsg struct { Video video // contains filtered or unexported fields }
func (*WxVideoMsg) Init ¶
func (this *WxVideoMsg) Init(w *WxMessageBody)
func (*WxVideoMsg) SetBody ¶
func (this *WxVideoMsg) SetBody(video string)
type WxVoiceMsg ¶
type WxVoiceMsg struct { Voice string `xml:"Voice>MediaId"` // contains filtered or unexported fields }
func (*WxVoiceMsg) Init ¶
func (this *WxVoiceMsg) Init(w *WxMessageBody)
Click to show internal directories.
Click to hide internal directories.