common

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSignMd5

func CheckSignMd5(data interface{}, signName, key string) (string, bool)

CheckSignMd5 检查数据的MD5是否正确

func GetTLSConfig

func GetTLSConfig(certpath, keypath, capath string) (*tls.Config, error)

GetTLSConfig 获取TLS Config

func IsEmptyValue

func IsEmptyValue(v reflect.Value) bool

IsEmptyValue 判断值是否为空

func Param

func Param(urlBase string, P map[string]string) string

Param 生成请求url参数

func RandomStr

func RandomStr(size int, Random int) string

RandomStr 随机字符串 Random = 0 // 纯数字 Random = 1 // 小写字母 Random = 2 // 大写字母 Random = 3 // 数字、大小写字母

func Requset

func Requset(req *http.Request) ([]byte, error)

Requset Requset

func RequsetJSON

func RequsetJSON(req *http.Request, tflag int) ([]byte, error)

RequsetJSON 发送微信请求

func RequsetXML

func RequsetXML(req *http.Request, tflag int, isXML ...bool) ([]byte, error)

RequsetXML 发送微信请求

func SignSha1

func SignSha1(data map[string]interface{}) string

SignSha1 hash1签名

func XMLSignMd5

func XMLSignMd5(data interface{}, key string) string

XMLSignMd5 MD5签名

Types

type JSONError

type JSONError struct {
	Errcode int    `json:"errcode"`
	Errmsg  string `json:"errmsg"`
}

JSONError 微信错误

type XMLError

type XMLError struct {
	XMLName    xml.Name `xml:"xml"`
	ReturnCode string   `xml:"return_code,omitempty"`
	ReturnMsg  string   `xml:"return_msg,omitempty"`
	ResultCode string   `xml:"result_code,omitempty"`
	ErrCode    string   `xml:"err_code,omitempty"`
	ErrCodeDes string   `xml:"err_code_des,omitempty"`
}

XMLError 微信错误

Jump to

Keyboard shortcuts

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