api

package
v0.0.0-...-c605425 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SESSION_KEY      = "_session_UserID" // session key
	CONTEXT_USER_KEY = "User"            // context user key

	SESSION_CAPTCHA = "GIN_CAPTCHA" // captcha session key
)

Variables

This section is empty.

Functions

func ActiveSubscriber

func ActiveSubscriber(c *gin.Context)

func ArchiveGet

func ArchiveGet(c *gin.Context)

func CommentReadAll

func CommentReadAll(c *gin.Context)

func CreateXMLSitemap

func CreateXMLSitemap()

func GetUnSubcribeUrl

func GetUnSubcribeUrl(subscriber *models.Subscriber) (string, error)

func HandleMessage

func HandleMessage(c *gin.Context, message string)

func SubscriberIndex

func SubscriberIndex(c *gin.Context)

func UnSubscribe

func UnSubscribe(c *gin.Context)

func WriteJSON

func WriteJSON(ctx *gin.Context, h gin.H)

Types

type BaseApi

type BaseApi struct {
}

func (*BaseApi) AdminUser

func (b *BaseApi) AdminUser(ctx *gin.Context) (*models.User, error)

func (*BaseApi) ClientUser

func (b *BaseApi) ClientUser(ctx *gin.Context) (*models.User, error)

func (*BaseApi) CurrentUser

func (b *BaseApi) CurrentUser(c *gin.Context, env string) (*models.User, error)

@title: 查询当前用户

func (*BaseApi) DefaultNoticeMailHtml

func (b *BaseApi) DefaultNoticeMailHtml(subject, body string) error

系统默认推送方式

func (*BaseApi) GetSessionValue

func (b *BaseApi) GetSessionValue(ctx *gin.Context, key string, isDelete bool) (value interface{}, err error)

func (*BaseApi) Handle404

func (b *BaseApi) Handle404(c *gin.Context)

func (*BaseApi) HandleMessage

func (b *BaseApi) HandleMessage(c *gin.Context, message string)

func (*BaseApi) HandlerError

func (b *BaseApi) HandlerError(message string, err error) bool

处理共同错误信息

func (*BaseApi) OperationSession

func (b *BaseApi) OperationSession(ctx *gin.Context, Key string, value interface{}) error

操作对于的session

func (*BaseApi) RenderComments

func (b *BaseApi) RenderComments(h gin.H) gin.H

func (*BaseApi) RenderHtml

func (b *BaseApi) RenderHtml(ctx *gin.Context, path string, h gin.H)

render html

func (*BaseApi) SendMailHtml

func (b *BaseApi) SendMailHtml(to, subject, body string) error

发送邮件

func (*BaseApi) WriteJSON

func (b *BaseApi) WriteJSON(ctx *gin.Context, h gin.H)

return json 格式 输出json格式

type CommentApi

type CommentApi struct {
	*BaseApi
}

func (*CommentApi) CommentDelete

func (comm *CommentApi) CommentDelete(c *gin.Context)

func (*CommentApi) CommentPost

func (comm *CommentApi) CommentPost(c *gin.Context)

func (*CommentApi) CommentRead

func (comm *CommentApi) CommentRead(c *gin.Context)

type IBaseApi

type IBaseApi interface {
	Index(ctx *gin.Context)
	Get(ctx *gin.Context)
	New(ctx *gin.Context)
	Create(ctx *gin.Context)
	Edit(ctx *gin.Context)
	Update(ctx *gin.Context)
	Delete(ctx *gin.Context)
}

type SubscribeApi

type SubscribeApi struct {
	*BaseApi
}

func (*SubscribeApi) Subscribe

func (s *SubscribeApi) Subscribe(c *gin.Context)

func (*SubscribeApi) SubscribeGet

func (s *SubscribeApi) SubscribeGet(c *gin.Context)

func (*SubscribeApi) SubscriberPost

func (s *SubscribeApi) SubscriberPost(c *gin.Context)

邮箱为空时,发送给所有订阅者

Jump to

Keyboard shortcuts

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