wechat

package
v0.0.0-...-6fe13d1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

all code from https://github.com/Yanjunhui/chat.git

Index

Constants

This section is empty.

Variables

View Source
var (
	CorpId         string
	AgentId        string
	SecretKey      string
	EncodingAESKey string

	TokenCache *cache.Cache
)

Functions

func GetAccessTokenFromWeixin

func GetAccessTokenFromWeixin()

从微信获取 AccessToken

func SendWxMsg

func SendWxMsg(toUser string, content string) error

func SetConfig

func SetConfig(corpid string, agentid string, secret string, aeskey string)

func StringToInt

func StringToInt(s string) int

string 类型转 int

func WxPost

func WxPost(url string, data MsgPost) (string, error)

微信请求数据

Types

type AccessToken

type AccessToken struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
	ErrCode     int    `json:"errcode"`
	ErrMsg      string `json:"errmsg"`
}

type Content

type Content struct {
	Content string `json:"content"`
}

发送信息

type MsgPost

type MsgPost struct {
	ToUser  string  `json:"touser"`
	MsgType string  `json:"msgtype"`
	AgentID int     `json:"agentid"`
	Text    Content `json:"text"`
}

Jump to

Keyboard shortcuts

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