wechat

package
v0.0.0-...-4a78be1 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

README

wechat-sender

请求URL

  • http://ip:port/sender/wechat
请求方式:
  • POST
请求头
参数名 是否必须 类型 说明
Content-Type string 请求类型:application/x-www-form-urlencoded || application/json
请求参数
参数名 是否必须 类型 说明
to string 收件人地址,多个接收者用`
content string 消息内容
contentType string 填 text(保留字段)

Documentation

Index

Constants

View Source
const (
	AccTokenURL       = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=%s&corpsecret=%s"
	SendmsgURL        = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=%s"
	TokeExpSec  int64 = 7200
)

Variables

View Source
var TLSClient *http.Client

Functions

This section is empty.

Types

type Content

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

type JsonMsg

type JsonMsg struct {
	ToUser  string  `json:"touser,omitempty"`
	ToParty string  `json:"toparty,omitempty"`
	MsgType string  `json:"msgtype"`
	AgentID int     `json:"agentid"`
	Text    Content `json:"text"`
}

func (JsonMsg) MarshalEasyJSON

func (v JsonMsg) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (JsonMsg) MarshalJSON

func (v JsonMsg) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*JsonMsg) UnmarshalEasyJSON

func (v *JsonMsg) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*JsonMsg) UnmarshalJSON

func (v *JsonMsg) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type WeChat

type WeChat struct {
	CorpID  string
	AgentID int
	Secret  string
	// contains filtered or unexported fields
}

func New

func New(CorpID string, AgentID int, Secret string) *WeChat

func (*WeChat) GetAccToken

func (wx *WeChat) GetAccToken() error

func (WeChat) MarshalEasyJSON

func (v WeChat) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (WeChat) MarshalJSON

func (v WeChat) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (WeChat) SendMsg

func (wx WeChat) SendMsg(touser, toparty, content string) ([]byte, error)

func (WeChat) UnmarshalEasyJSON

func (v WeChat) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (WeChat) UnmarshalJSON

func (v WeChat) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

Jump to

Keyboard shortcuts

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