http

package
v0.0.0-...-18bff62 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2019 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LayoutTpl      = "common/layout.html"
	AdminLayoutTpl = "common.html"
)
View Source
const (
	TokenSalt       = "b3%JFOykZx_golang_polaris"
	NeedReLoginCode = 600
)

Variables

View Source
var Store = sessions.NewCookieStore([]byte(config.ConfigFile.MustValue("global", "cookie_secret")))

Functions

func AccessControl

func AccessControl(ctx echo.Context)

func CheckIsHttps

func CheckIsHttps(ctx echo.Context) bool

func GenToken

func GenToken(uid int) string

func GetCookieSession

func GetCookieSession(ctx echo.Context) *sessions.Session

必须是 http.Request

func GetFromCookie

func GetFromCookie(ctx echo.Context, key string) string

func ParseToken

func ParseToken(token string) (int, bool)

func Render

func Render(ctx echo.Context, contentTpl string, data map[string]interface{}) error

Render html 输出

func RenderAdmin

func RenderAdmin(ctx echo.Context, contentTpl string, data map[string]interface{}) error

RenderAdmin html 输出

func RenderQuery

func RenderQuery(ctx echo.Context, contentTpl string, data map[string]interface{}) error

后台 query 查询返回结果

func Request

func Request(ctx echo.Context) *http.Request

func ResponseWriter

func ResponseWriter(ctx echo.Context) http.ResponseWriter

func SetCookie

func SetCookie(ctx echo.Context, key, value string)

func SetLoginCookie

func SetLoginCookie(ctx echo.Context, username string)

func ValidateToken

func ValidateToken(token string) bool

Types

This section is empty.

Directories

Path Synopsis
app
app Go 语言中文网 APP 接口
app Go 语言中文网 APP 接口
internal

Jump to

Keyboard shortcuts

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