From 2549f2614738a6a406a67bd158ba659ffff14d94 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Thu, 23 Jul 2020 21:06:30 +0800 Subject: [PATCH] =?UTF-8?q?upgrade=EF=BC=9ATemplate=20upgrade?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/api.go.template | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/template/api.go.template b/template/api.go.template index 80239660..fbc85942 100644 --- a/template/api.go.template +++ b/template/api.go.template @@ -24,8 +24,13 @@ pageIndex = tools.StrToInt(err, index) {{ range .Columns -}} {{$z := .IsQuery}} - {{- if ($z) -}}data.{{.GoField}} = c.Request.FormValue("{{.JsonField}}") - {{ end -}} + {{- if ($z) -}} + {{ if eq (.GoType) "int" -}} + data.{{.GoField}}, _ = tools.StringToInt(c.Request.FormValue("{{.JsonField}}")) + {{ else -}} + data.{{.GoField}} = c.Request.FormValue("{{.JsonField}}") + {{ end }} + {{- end -}} {{end}} data.DataScope = tools.GetUserIdStr(c)