utils

package module
v0.0.0-...-1acf2d3 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2018 License: MIT Imports: 25 Imported by: 0

README

utils

Documentation

Index

Constants

View Source
const (
	NeteaseAppKey    = "7ceb11438d399c096be71884b3aee8e9"
	NeteaseAppSecret = "96506ddc03b6"
	SmsTemplateID    = "3033646"

	InterfaceSendSmsCode   = "https://api.netease.im/sms/sendcode.action"
	InterfaceVerifySmsCode = "https://api.netease.im/sms/verifycode.action"
)

Variables

View Source
var (
	Requests requests
)

Functions

func AesCBCDecrypt

func AesCBCDecrypt(encryptData, key []byte) ([]byte, error)

func AesCBCEncrypt

func AesCBCEncrypt(rawData, key []byte) ([]byte, error)

func ByteToHex

func ByteToHex(data [20]byte) string

func CheckFieldLength

func CheckFieldLength(v string, max int, cn string) (bool, errors.Error)

func Combination

func Combination(n, m int) int

func CombinationResult

func CombinationResult(n int, m int) [][]int

func Decrypt

func Decrypt(rawData string, key []byte) (string, error)

func Encrypt

func Encrypt(rawData, key []byte) (string, error)

func ErrMail

func ErrMail(title, content string)

func Factorial

func Factorial(n int) int

func FindNumsByIndexes

func FindNumsByIndexes(nums []int, indexes [][]int) [][]int

func GetDBFromContext

func GetDBFromContext(c *gin.Context, schema string) (*gorm.DB, error)

func GetRandomString

func GetRandomString(l int) string

func GetUserIDFromContext

func GetUserIDFromContext(c *gin.Context) int

func GetWxaCode

func GetWxaCode(token, scene, page string) (string, error)

func IsLoggedIn

func IsLoggedIn(c *gin.Context) bool

func JudgeExistInRegion

func JudgeExistInRegion(lat1, lat2, lng1, lng2, distance float64) bool

distance unit is km

func MpGetUserFromHeader

func MpGetUserFromHeader(c *gin.Context) (string, error)

func PKCS7Padding

func PKCS7Padding(cipherText []byte, blockSize int) []byte

func PKCS7UnPadding

func PKCS7UnPadding(origData []byte) []byte

func PointSquareWithDistance

func PointSquareWithDistance(lat, lng, distance float64) (latScope [2]float64, lngScope [2]float64)

distance unit is km

func SendSmsCode

func SendSmsCode(phone string) (bool, error)

func Substr

func Substr(str string, start int, length int) string

func VerifySmsCode

func VerifySmsCode(phone, code string) (bool, error)

Types

type HTTPCallback

type HTTPCallback interface {
	Do(req *fasthttp.Request, resp *fasthttp.Response) interface{}
}

type HTTPResponse

type HTTPResponse struct {
	CallbackOutput []interface{}
	// contains filtered or unexported fields
}

func (*HTTPResponse) Body

func (h *HTTPResponse) Body() []byte

func (*HTTPResponse) ContentType

func (h *HTTPResponse) ContentType() string

func (*HTTPResponse) Json

func (h *HTTPResponse) Json(v interface{}) error

func (*HTTPResponse) Status

func (h *HTTPResponse) Status() int

func (*HTTPResponse) Text

func (h *HTTPResponse) Text() string

type TimeIt

type TimeIt struct {
	// contains filtered or unexported fields
}

func NewTimeIt

func NewTimeIt(module string) *TimeIt

func (*TimeIt) End

func (t *TimeIt) End()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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