wechat: github.com/silenceper/wechat Index | Files | Directories

package wechat

import "github.com/silenceper/wechat"

Package wechat provide wechat sdk for go

使用Golang开发的微信SDK,简单、易用。

以下是一个处理消息接收以及回复的例子:

//配置微信参数
config := &wechat.Config{
	AppID:          "xxxx",
	AppSecret:      "xxxx",
	Token:          "xxxx",
	EncodingAESKey: "xxxx",
}
wc := wechat.NewWechat(config)

// 传入request和responseWriter
server := wc.GetServer(request, responseWriter)
server.SetMessageHandler(func(msg message.MixMessage) *message.Reply {

	//回复消息:演示回复用户发送的消息
	text := message.NewText(msg.Content)
	return &message.Reply{message.MsgText, text}
})

server.Serve()
server.Send()

更多信息:https://github.com/silenceper/wechat

Index

Package Files

doc.go wechat.go

type Config Uses

type Config struct {
    AppID          string
    AppSecret      string
    Token          string
    EncodingAESKey string
    PayMchID       string //支付 - 商户 ID
    PayNotifyURL   string //支付 - 接受微信支付结果通知的接口地址
    PayKey         string //支付 - 商户后台设置的支付 key
    Cache          cache.Cache
}

Config for user

type Wechat Uses

type Wechat struct {
    Context *context.Context
}

Wechat struct

func NewWechat Uses

func NewWechat(cfg *Config) *Wechat

NewWechat init

func (*Wechat) GetAccessToken Uses

func (wc *Wechat) GetAccessToken() (string, error)

GetAccessToken 获取access_token

func (*Wechat) GetJs Uses

func (wc *Wechat) GetJs() *js.Js

GetJs js-sdk配置

func (*Wechat) GetMaterial Uses

func (wc *Wechat) GetMaterial() *material.Material

GetMaterial 素材管理

func (*Wechat) GetMenu Uses

func (wc *Wechat) GetMenu() *menu.Menu

GetMenu 菜单管理接口

func (*Wechat) GetMiniProgram Uses

func (wc *Wechat) GetMiniProgram() *miniprogram.MiniProgram

GetMiniProgram 获取小程序的实例

func (*Wechat) GetOauth Uses

func (wc *Wechat) GetOauth() *oauth.Oauth

GetOauth oauth2网页授权

func (*Wechat) GetPay Uses

func (wc *Wechat) GetPay() *pay.Pay

GetPay 返回支付消息的实例

func (*Wechat) GetQR Uses

func (wc *Wechat) GetQR() *qr.QR

GetQR 返回二维码的实例

func (*Wechat) GetServer Uses

func (wc *Wechat) GetServer(req *http.Request, writer http.ResponseWriter) *server.Server

GetServer 消息管理

func (*Wechat) GetTemplate Uses

func (wc *Wechat) GetTemplate() *template.Template

GetTemplate 模板消息接口

func (*Wechat) GetUser Uses

func (wc *Wechat) GetUser() *user.User

GetUser 用户管理接口

Directories

PathSynopsis
cache
context
js
material
menu
message
miniprogram
oauth
pay
qr
server
template
user
util

Package wechat imports 14 packages (graph) and is imported by 1 packages. Updated 2019-04-23. Refresh now. Tools for package owners.