Documentation ¶
Index ¶
- Variables
- func BackendURL() string
- func BackendUploadURL(subdir string, values ...interface{}) string
- func FrontendURL() string
- func FrontendUploadURL(subdir string, values ...interface{}) string
- func Token(values ...interface{}) string
- func URLParam(subdir string, values ...interface{}) string
- type APIKey
- type Checker
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 DefaultNoCheck = func(ctx echo.Context) (subdir string, name string, err error) { subdir = time.Now().Format(`2006/01/02/`) return }
DefaultNoCheck 默认 Checker
View Source
var DefaultWithVerify = 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, `令牌错误`) return } if time.Now().Unix()-timestamp > UploadURLMaxAge { err = ctx.NewError(code.DataHasExpired, `上传网址已过期`) return } return DefaultNoCheck(ctx) }
View Source
var UploadURLMaxAge int64 = 86400
UploadURLMaxAge 上传链接生存时间
Functions ¶
func BackendUploadURL ¶
BackendUploadURL 构建后台上传网址
func FrontendUploadURL ¶
FrontendUploadURL 构建前台上传网址
Types ¶
Click to show internal directories.
Click to hide internal directories.