libUtils

package
v0.0.0-...-14a2a1b Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LETTERS_RULES = [...]string{lettersRule1, lettersRule2, lettersRule3, lettersRule4, lettersRule5}

Functions

func EncryptPassword

func EncryptPassword(password, salt string) string

EncryptPassword 密码加密

func FileIsExisted

func FileIsExisted(filename string) bool

文件或文件夹是否存在

func GenCardCode

func GenCardCode(ctx context.Context, cardLen int, secretKey string) (cardCode string)

GenCardCode 生成卡号 简单粗暴的生成方式,根据输入的长度,遍历模板 TODO

func GenSecret

func GenSecret(length int) (secret string)

GenSecret 生成指定长度字符串

func GetCityByIp

func GetCityByIp(ip string) string

GetCityByIp 获取ip所属城市

func GetClientIp

func GetClientIp(ctx context.Context) string

GetClientIp 获取客户端IP

func GetDomain

func GetDomain(ctx context.Context) string

GetDomain 获取当前请求接口域名

func GetExt

func GetExt(fileName string) string

获取文件后缀

func GetLocalIP

func GetLocalIP() (ip string, err error)

GetLocalIP 服务端ip

func GetType

func GetType(p string) (result string, err error)

GetType 获取文件类型

func GetUserAgent

func GetUserAgent(ctx context.Context) string

GetUserAgent 获取user-agent

func IsNotExistMkDir

func IsNotExistMkDir(src string) error

IsNotExistMkDir 检查文件夹是否存在 如果不存在则新建文件夹

func LanZouCloud

func LanZouCloud() *sLanZouCloud

func MkDir

func MkDir(src string) error

MkDir 新建文件夹

func ParseCardCode

func ParseCardCode(prefix string, secretKey string)

TODO

func ParseFilePath

func ParseFilePath(pathStr string) (fileName string, fileType string)

解析路径获取文件名称及后缀

func SetExpireTime

func SetExpireTime(activeTime *gtime.Time, cardType int, value int) (expireTime *gtime.Time, err error)

func WriteToFile

func WriteToFile(fileName string, content string) error

写入文件

Types

This section is empty.

Jump to

Keyboard shortcuts

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