Documentation ¶
Index ¶
- Constants
- Variables
- func AuthCheckRole() gin.HandlerFunc
- func AuthInit() (*jwt.GinJWTMiddleware, error)
- func CustomError(c *gin.Context)
- func GenerateCaptchaHandler(c *gin.Context)
- func GetHourDiffer(startTime, endTime string) int64
- func GinWrapper(handler http.Handler) gin.HandlerFunc
- func InitMiddleware(r *gin.Engine)
- func LoggerToFile() gin.HandlerFunc
- func Metrics() gin.HandlerFunc
- func NoCache(c *gin.Context)
- func Options(c *gin.Context)
- func Ping(c *gin.Context)
- func RequestId(trafficKey string) gin.HandlerFunc
- func Secure(c *gin.Context)
- func Sentinel() gin.HandlerFunc
- func ServerInfo(c *gin.Context)
- func SetDBOperLog(c *gin.Context, clientIP string, statusCode int, reqUri string, ...)
- func TlsHandler() gin.HandlerFunc
- func Trace() gin.HandlerFunc
- func WithContextDb(c *gin.Context)
- type File
- type FileResponse
- type UrlInfo
Constants ¶
const ( B = 1 KB = 1024 * B MB = 1024 * KB GB = 1024 * MB )
Variables ¶
var CasbinExclude = []UrlInfo{
{Url: "/api/v1/dict/type-option-select", Method: "GET"},
{Url: "/api/v1/dict-data/option-select", Method: "GET"},
{Url: "/api/v1/deptTree", Method: "GET"},
{Url: "/api/v1/menu-role", Method: "GET"},
{Url: "/api/v1/configKey/:configKey", Method: "GET"},
{Url: "/api/v1/app-config", Method: "GET"},
{Url: "/api/v1/getinfo", Method: "GET"},
{Url: "/api/v1/user/profile", Method: "GET"},
{Url: "/api/v1/user/avatar", Method: "POST"},
{Url: "/api/v1/user/pwd", Method: "PUT"},
{Url: "/api/v1/user/status", Method: "PUT"},
{Url: "/api/v1/roleMenuTreeSelect/:roleId", Method: "GET"},
{Url: "/api/v1/roleDeptTreeSelect/:roleId", Method: "GET"},
{Url: "/api/v1/public/uploadFile", Method: "POST"},
{Url: "/api/v1/captcha", Method: "GET"},
{Url: "/api/v1/login", Method: "POST"},
{Url: "/api/v1/logout", Method: "POST"},
{Url: "/api/v1/refresh_token", Method: "GET"},
{Url: "/metrics", Method: "GET"},
{Url: "/health", Method: "GET"},
{Url: "/", Method: "GET"},
{Url: "/info", Method: "GET"},
{Url: "/server-monitor", Method: "GET"},
}
CasbinExclude casbin 排除的路由列表
Functions ¶
func CustomError ¶
func GenerateCaptchaHandler ¶
GenerateCaptchaHandler 获取验证码 @Summary 获取验证码 @Description 获取验证码 @Tags 登陆 @Success 200 {object} response.Response{data=string,id=string,msg=string} "{"code": 200, "data": [...]}" @Router /api/v1/captcha [get]
func GinWrapper ¶
func GinWrapper(handler http.Handler) gin.HandlerFunc
GinWrapper http.Handler 转换成 gin.HandlerFunc
func InitMiddleware ¶
func NoCache ¶
NoCache is a middleware function that appends headers to prevent the client from caching the HTTP response.
func Options ¶
Options is a middleware function that appends headers for options requests and aborts then exits the middleware chain and ends the request.
func RequestId ¶
func RequestId(trafficKey string) gin.HandlerFunc
RequestId 自动增加requestId, 设置 logger
func ServerInfo ¶
ServerInfo 获取系统信息 @Summary 系统信息 @Description 获取JSON @Tags 系统信息 @Success 200 {object} response.Response "{"code": 200, "data": [...]}" @Router /server-monitor [get] @Security Bearer
func SetDBOperLog ¶
func SetDBOperLog(c *gin.Context, clientIP string, statusCode int, reqUri string, reqMethod string, latencyTime time.Duration, body string, result string, status int)
SetDBOperLog 写入操作日志表 fixme 该方法后续即将弃用
func TlsHandler ¶
func TlsHandler() gin.HandlerFunc
func WithContextDb ¶
Types ¶
type File ¶
func (File) UploadFile ¶
UploadFile 上传图片 @Summary 上传图片 @Description 获取JSON @Tags 公共接口 @Accept multipart/form-data @Param type query string true "type" (1:单图,2:多图, 3:base64图片) @Param file formData file true "file" @Success 200 {string} string "{"code": 200, "message": "添加成功"}" @Success 200 {string} string "{"code": -1, "message": "添加失败"}" @Router /api/v1/public/uploadFile [post] @Security Bearer