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 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 BackendUploadURL ¶
BackendUploadURL 构建后台上传网址
func FrontendUploadURL ¶
FrontendUploadURL 构建前台上传网址
Types ¶
Click to show internal directories.
Click to hide internal directories.