接口入口函数首个参数支持custom context
This commit is contained in:
@ -69,8 +69,9 @@ func (c controller) methodConfig(reflectMethod reflect.Method) (cfg UriConfig, n
|
||||
needRegister = false
|
||||
return
|
||||
}
|
||||
// 第一个参数必须是 *gin.Context
|
||||
if methodType.In(1).String() != GinContextType {
|
||||
// 第一个参数必须是 *gin.Context 或者 *define.Context
|
||||
paramOne := methodType.In(1).String()
|
||||
if paramOne != GinContextType && paramOne != CustomContextType {
|
||||
needRegister = false
|
||||
return
|
||||
}
|
||||
@ -106,6 +107,7 @@ func (c controller) methodConfig(reflectMethod reflect.Method) (cfg UriConfig, n
|
||||
}
|
||||
}
|
||||
// 解析meta信息
|
||||
cfg.CtxType = paramOne
|
||||
cfg.Path = metaField.Tag.Get(TagNamePath)
|
||||
cfg.RequestMethod = metaField.Tag.Get(TagNameMethod)
|
||||
cfg.Desc = metaField.Tag.Get(TagNameDesc)
|
||||
|
Reference in New Issue
Block a user