middleWare

package
v0.0.0-...-f9e7125 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetParams

func GetParams(request *gin.Context) map[string]interface{}

获取客户端的请求参数

func GetValue

func GetValue(post map[string]interface{}, key string, defaultVallue ...interface{}) interface{}

获取map数据

func LogerMiddleware

func LogerMiddleware() gin.HandlerFunc

func RequestMiddleWare

func RequestMiddleWare() gin.HandlerFunc

定义中间 不生效

func SetCommon

func SetCommon(data AllBody, request *gin.Context)

设置公共参数

func SetParams

func SetParams(data AllBody, request *gin.Context)

设置请求参数

Types

type AllBody

type AllBody struct {
	Common Common
	Params map[string]interface{}
}

type Common

type Common struct {
	AppId        string `json:"app_id"`
	VersionName  string `json:"version_name"`
	VersionBuild string `json:"version_build"`
	ClientAgent  string `json:"clientagent"`
	DistinctId   string `json:"distinct_id"`
	MjbAppid     int    `json:"mjb_appid"`
	CityId       int    `json:"city_id"`
	Token        string `json:"token"`
	AppVersion   string `json:"version_code"`
}

设置公共请求参数

type LogFormat

type LogFormat struct {
	StatusCode  int           `gorm:"statusCode" json:"statusCode";`
	LatencyTime time.Duration `gorm:"latencyTime"`
	ClientIP    string        `gorm:"clientIP"`
	ReqMethod   string        `gorm:"reqMethod"`
	ReqUrl      string        `gorm:"reqUrl"`
}

Jump to

Keyboard shortcuts

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