util

package
v0.0.0-...-01c5a3f Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ContentType = "application/json"
View Source
var SigningKey = []byte("AllYourBase")

Functions

func CheckCaptcha

func CheckCaptcha(captchaId string, captcha string) (result bool)

func CreateDir

func CreateDir(path string)

func CreateToken

func CreateToken(claim Claim) (tokenString string, err error)

func DesDecrypt

func DesDecrypt(data string, key []byte) string

DES解密

func DesEncrypt

func DesEncrypt(origData []byte, key []byte) string

DES加密

func DirIsExist

func DirIsExist(path string) (result bool, err error)

func HttpGet

func HttpGet(url string) (responseStr string, err error)

func HttpPost

func HttpPost(url string, request interface{}) (responseStr string, err error)

func HttpPostStr

func HttpPostStr(url string, request string) (responseStr string, err error)

func MD5

func MD5(str string) string

Md5加密

func PKCS5Padding

func PKCS5Padding(ciphertext []byte, blockSize int) []byte

实现明文的补码

func PKCS5UnPadding

func PKCS5UnPadding(origData []byte) []byte

去除补码

Types

type Captcha

type Captcha struct {
	CaptchaId   string `json:"captchaId" form:"captchaId"`     // 验证码Id
	CaptchaPath string `json:"captchaPath" form:"captchaPath"` //验证码路径
}

验证码

func GetCaptcha

func GetCaptcha() (result Captcha, err error)

type Claim

type Claim struct {
	jwt.RegisteredClaims
	Id       int64  `json:"id" form:"id" `             //Id
	UserName string `json:"userName" form:"userName" ` //用户名
	Name     string `json:"name" form:"name"`          //名称
}

声明

func ParseToken

func ParseToken(tokenString string) (claim *Claim, err error)

Jump to

Keyboard shortcuts

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