yjp 1 rok temu
rodzic
commit
617d633c05
1 zmienionych plików z 3 dodań i 2 usunięć
  1. 3 2
      http_binding/http_binding.go

+ 3 - 2
http_binding/http_binding.go

@@ -95,8 +95,8 @@ func (item *BindItem[I, O]) bind(routerGroup *gin.RouterGroup, middlewares ...mi
 		panic("需要指定响应函数")
 	}
 
-	var inputModel I
-	inputType := reflect.TypeOf(inputModel)
+	var inputCheckModel I
+	inputType := reflect.TypeOf(inputCheckModel)
 	if inputType != nil {
 		if inputType.Kind() == reflect.Pointer {
 			panic("输入对象不能使用指针类型")
@@ -117,6 +117,7 @@ func (item *BindItem[I, O]) bind(routerGroup *gin.RouterGroup, middlewares ...mi
 
 	ginHandleFunctions = append(ginHandleFunctions, func(c *gin.Context) {
 		bindingContext := &binding_context.Context{Context: c}
+		var inputModel I
 
 		if inputType != nil {
 			if item.OptionalBindingFunc != nil {