core

package
v0.0.0-...-8d6dda1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2020 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const AdminContextKey = "ecology/context/admin"
View Source
const AdminSessionKey = "ecology/session/admin"
View Source
const FrontContextKey = "ecology/context/front"
View Source
const FrontSessionKey = "ecology/session/front"
View Source
const Options = "MDW_OPTIONS"
View Source
const TPL = "MDW_TPL"

Variables

This section is empty.

Functions

func AdminContextUser

func AdminContextUser(c *gin.Context) *mysql.User

后台取用户

func AdminLoginRequired

func AdminLoginRequired() gin.HandlerFunc

后台取用户

func AdminSessionUser

func AdminSessionUser(c *gin.Context) (*mysql.User, bool)

后台取用户

func BaseUrl

func BaseUrl(c *gin.Context) string

func FrontContextUser

func FrontContextUser(c *gin.Context) *mysql.Member

后台取用户

func FrontLoginRequired

func FrontLoginRequired() gin.HandlerFunc

后台取用户

func FrontSessionUser

func FrontSessionUser(c *gin.Context) (*mysql.Member, bool)

后台取用户

func FrontTplRequired

func FrontTplRequired() gin.HandlerFunc

func Handle

func Handle(h HandlerFunc) gin.HandlerFunc

Types

type Context

type Context struct {
	*gin.Context
}

func (*Context) AdminAuthed

func (c *Context) AdminAuthed() bool

Authed 鉴权通过

func (*Context) AdminLogout

func (c *Context) AdminLogout() error

Logout will clear out the session and call the Logout() user function.

func (*Context) AdminUid

func (c *Context) AdminUid() int

后台 Uid 返回uid

func (*Context) AdminUpdateUser

func (c *Context) AdminUpdateUser(a *mysql.User) error

UpdateUser updates the User object stored in the session. This is useful incase a change is made to the user model that needs to persist across requests.

func (*Context) BaseUrl

func (c *Context) BaseUrl() string

func (*Context) Download

func (c *Context) Download(file string, filename ...string)

func (*Context) ExecuteViewPathTemplate

func (c *Context) ExecuteViewPathTemplate(tplName string, data interface{}) (string, error)

ExecuteViewPathTemplate 执行指定的模板并返回执行结果.

func (*Context) ForbidGeneralRole

func (c *Context) ForbidGeneralRole() bool

func (*Context) GetPostFormString

func (c *Context) GetPostFormString(key string) string

func (*Context) GetSeoByPage

func (c *Context) GetSeoByPage(page string, defSeo map[string]string)

根据页面获取seo @param page 页面标识 @param defSeo 默认的seo的map,必须有title、keywords和description字段

func (*Context) GetSeoPage

func (c *Context) GetSeoPage()

func (*Context) GetSession

func (c *Context) GetSession(key string) interface{}

func (*Context) Html

func (c *Context) Html(path string)

func (*Context) Html404

func (c *Context) Html404()

func (*Context) JSONCode

func (c *Context) JSONCode(Code int, data ...interface{})

JSON 提供了系统标准JSON输出方法。

func (*Context) JSONErr

func (c *Context) JSONErr(Code int, err error)

JSON 提供了系统标准JSON输出方法。

func (*Context) JSONErrStr

func (c *Context) JSONErrStr(Code int, err string)

func (*Context) JSONErrTips

func (c *Context) JSONErrTips(msg string, err error)

func (*Context) JSONList

func (c *Context) JSONList(data interface{}, current, pageSize, total int)

func (*Context) JSONOK

func (c *Context) JSONOK(result ...interface{})

func (*Context) LoginByMemberId

func (c *Context) LoginByMemberId(memberId int) (err error)

func (*Context) Logout

func (c *Context) Logout() error

Logout will clear out the session and call the Logout() user function.

func (*Context) Member

func (c *Context) Member() *mysql.Member
func (c *Context) ReplaceLinks(bookIdentify string, docHtml string, isSummary ...bool) string

替换链接 如果是summary,则根据这个进行排序调整

func (*Context) SaveToFile

func (c *Context) SaveToFile(fromfile, tofile string) error

SaveToFile saves uploaded file to new path. it only operates the first one of mutil-upload form file field.

func (*Context) SaveToFileImg

func (c *Context) SaveToFileImg(fromfile string) (tofile string, name string, err error)

func (*Context) SetSecureCookie

func (c *Context) SetSecureCookie(Secret, name, value string, others ...interface{})

SetSecureCookie Set Secure cookie for response.

func (*Context) SetSession

func (c *Context) SetSession(key, value string) error

func (*Context) Tpl

func (c *Context) Tpl() *tplbeego.Tmpl

func (*Context) UpdateUser

func (c *Context) UpdateUser(a *mysql.Member) error

UpdateUser updates the User object stored in the session. This is useful incase a change is made to the user model that needs to persist across requests.

type HandlerFunc

type HandlerFunc func(c *Context)

type JSONResult

type JSONResult struct {
	Code    int         `json:"code"`
	Message string      `json:"msg"`
	Data    interface{} `json:"data"`
}

JSONResult json

type RespList

type RespList struct {
	List       interface{} `json:"list"`
	Pagination struct {
		Current  int `json:"current"`
		PageSize int `json:"pageSize"`
		Total    int `json:"total"`
	} `json:"pagination"`
}

type WechatRespList

type WechatRespList struct {
	List  interface{} `json:"list"`
	Total int         `json:"total"`
}

Jump to

Keyboard shortcuts

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