代码拉取完成,页面将自动刷新
package admin
import (
"gitee.com/jikey/elk-blog/setting"
"github.com/gin-gonic/gin"
"reflect"
"strings"
)
type ControllerInterface interface {
beforeAction(c *gin.Context) error
afterAction(c *gin.Context) error
}
type Controller struct {
actionName string
viewDir string // view 默认文件夹(相对路径)
this ControllerInterface // 实例
}
var Site = setting.Config.Site
func (ctrl *Controller) Init(this ControllerInterface) error {
ctrl.this = this
className := reflect.TypeOf(ctrl.this).String()
className = className[strings.LastIndex(className, ".")+1:]
ctrl.actionName = strings.TrimRight(className, "Controller")
return nil
}
/*
*
action调用前回调
*/
func (ctrl *Controller) beforeAction(c *gin.Context) error {
return nil
}
/*
*
action调用后回调
*/
func (ctrl *Controller) afterAction(c *gin.Context) error {
return nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。