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(custom func(ret map[string]interface{}) map[string]interface{}) gin.HandlerFunc
- 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 PresignToken
- type PresignTokenRequest
- type PresignTokenResponse
- type UrlInfo
Constants ¶
const ( B = 1 KB = 1024 * B MB = 1024 * KB GB = 1024 * MB )
const DownloadUrlPrefix = "/public/downloadFile/"
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 ¶
func ServerInfo(custom func(ret map[string]interface{}) map[string]interface{}) gin.HandlerFunc
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, apiCode int)
SetDBOperLog 写入操作日志表 fixme 该方法后续即将弃用
func TlsHandler ¶
func TlsHandler() gin.HandlerFunc
func WithContextDb ¶
Types ¶
type File ¶
func (File) DownloadFile ¶ added in v1.0.20
DownloadFile 下载文件 @Summary 下载文件 @Description 下载文件 @Tags 公共接口 @Param pathname path string true "pathname" @Param filename path string true "filename" @Param as query string true "as" @Success 200 @Failure 503 @Success 200 {object} response.Response "{"code": 200, "data": [...]}" @Router /public/downloadFile/{pathname}/{filename} [get] @Security Bearer
func (File) ImportTempFile ¶ added in v1.0.20
func (e File) ImportTempFile(c *gin.Context) (*FileResponse, error)
ImportTempFile upload a temp 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
type FileResponse ¶
type PresignToken ¶ added in v1.0.32
func (PresignToken) PresignToken ¶ added in v1.0.35
func (e PresignToken) PresignToken(c *gin.Context)
PresignToken 预签名令牌 @Summary 预签名令牌 @Description 预签名令牌 @Tags 公共接口 @Param data body PresignTokenRequest true "data" @Failure 500 @Success 200 {object} PresignTokenResponse "{"code": 200, "data": [...]}" @Router /presign-token [post] @Security Bearer
type PresignTokenRequest ¶ added in v1.0.32
type PresignTokenResponse ¶ added in v1.0.32
type PresignTokenResponse struct { Vendor string `json:"vendor"` Token interface{} `json:"token"` }