common

package
v0.0.0-...-4162a9b Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WechatErrorLoggerWriter io.Writer = os.Stderr
View Source
var WechatLoggerWriter io.Writer = os.Stdout

Functions

func GetMsgEventFromWechatMessage

func GetMsgEventFromWechatMessage(message []byte) string

从微信事件消息中,提取事件类型

func GetMsgTypeFromWechatMessage

func GetMsgTypeFromWechatMessage(message []byte) string

从微信消息中,提取MsgType

func GetRandomString

func GetRandomString(length int) []byte

获取随机字节数组

func HTTPGet

func HTTPGet(url string) ([]byte, error)

HTTP Get 请求

func HTTPPostForm

func HTTPPostForm(url string, fields map[string]string, files ...MultipartFormFile) ([]byte, error)

HTTP POST form表单提交 url:文件上传访问路径 fields: 表单字段 files: 表单文件

func HTTPPostJson

func HTTPPostJson(url string, obj interface{}) ([]byte, error)

HTTP Post Json请求

Types

type MultipartFormFile

type MultipartFormFile struct {
	FieldName string    // 文件入参名称
	FileName  string    // 文件名称
	Reader    io.Reader // 文件输入流
}

文件上传结构体

type PublicError

type PublicError struct {
	Errcode int    `json:"errcode,omitempty"` // 错误码
	Errmsg  string `json:"errmsg,omitempty"`  // 错误描述
}

Jump to

Keyboard shortcuts

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