http

package
v0.0.0-...-04c5af6 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2020 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(setting.Get().GetString("global.cookie_secret")))

Functions

func AccessControl

func AccessControl(ctx echo.Context)

func CheckIsHttps

func CheckIsHttps(ctx echo.Context) bool

若是处于代理后边,代理应该转发一个X-Forwarded-Proto来表示请求的协议

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