server

package
v2.1.1-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2022 License: Apache-2.0 Imports: 12 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	*context.Context
	Writer  http.ResponseWriter
	Request *http.Request

	RequestRawXMLMsg  []byte
	RequestMsg        *message.MixMessage
	ResponseRawXMLMsg []byte
	ResponseMsg       interface{}
	// contains filtered or unexported fields
}

Server struct

func NewServer

func NewServer(context *context.Context) *Server

NewServer init

func (*Server) GetOpenID

func (srv *Server) GetOpenID() string

GetOpenID return openID

func (*Server) GetQuery

func (srv *Server) GetQuery(key string) (string, bool)

GetQuery is like Query(), it returns the keyed url query value

func (*Server) Query

func (srv *Server) Query(key string) string

Query returns the keyed url query value if it exists

func (*Server) Render

func (srv *Server) Render(bytes []byte)

Render render from bytes

func (*Server) Send

func (srv *Server) Send() (err error)

Send 将自定义的消息发送

func (*Server) Serve

func (srv *Server) Serve() error

Serve 处理微信的请求消息

func (*Server) SetMessageHandler

func (srv *Server) SetMessageHandler(handler func(*message.MixMessage) *message.Reply)

SetMessageHandler 设置用户自定义的回调方法

func (*Server) SkipValidate

func (srv *Server) SkipValidate(skip bool)

SkipValidate set skip validate

func (*Server) String

func (srv *Server) String(str string)

String render from string

func (*Server) Validate

func (srv *Server) Validate() bool

Validate 校验请求是否合法

func (*Server) XML

func (srv *Server) XML(obj interface{})

XML render to xml

Jump to

Keyboard shortcuts

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