checker

package
v3.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//BackendUploadPath 后台上传网址路径
	BackendUploadPath = `/manager/upload`
	//FrontendUploadPath 前台上传网址路径
	FrontendUploadPath = `/user/file/upload`
	//SetURLParamDefaultValue 设置参数默认值
	SetURLParamDefaultValue func(*url.Values)
)
View Source
var Default = func(ctx echo.Context) (subdir string, name string, err error) {
	timestamp := ctx.Formx(`time`).Int64()

	if ctx.Form(`token`) != Token(ctx.Queries()) {
		err = ctx.NewError(code.InvalidParameter, ctx.T(`令牌错误`))
		return
	}
	if time.Now().Local().Unix()-timestamp > UploadURLMaxAge {
		err = ctx.NewError(code.DataHasExpired, ctx.T(`上传网址已过期`))
		return
	}
	subdir = time.Now().Local().Format(`2006/01/02/`)
	return
}

Default 默认Checker

View Source
var UploadURLMaxAge int64 = 86400

UploadURLMaxAge 上传链接生存时间

Functions

func BackendURL

func BackendURL() string

BackendURL 后台网址

func BackendUploadURL

func BackendUploadURL(subdir string, values ...interface{}) string

BackendUploadURL 构建后台上传网址

func FrontendURL

func FrontendURL() string

FrontendURL 前台网址

func FrontendUploadURL

func FrontendUploadURL(subdir string, values ...interface{}) string

FrontendUploadURL 构建前台上传网址

func Token

func Token(values ...interface{}) string

Token 生成签名

func URLParam

func URLParam(subdir string, values ...interface{}) string

URLParam URLParam(`refid`,123)

Types

type APIKey

type APIKey interface {
	APIKey() string
}

APIKey API Key

type Checker

type Checker func(echo.Context) (subdir string, name string, err error)

Checker 验证并生成子文件夹名称和文件名称

Jump to

Keyboard shortcuts

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