update
This commit is contained in:
1 parent
f25da5f1ee
commit
1df55e75e5
72 files changed
+1401
-1559
No files matched your search
+7
-7
@@ -3,23 +3,23 @@ package tools
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go-admin/models"
|
||||
"go-admin/models/tools"
|
||||
"go-admin/pkg"
|
||||
"go-admin/utils"
|
||||
"go-admin/pkg/app"
|
||||
"go-admin/pkg/utils"
|
||||
"net/http"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
func Preview(c *gin.Context) {
|
||||
table := tools.SysTables{}
|
||||
id, err := utils.StringToInt64(c.Param("tableId"))
|
||||
pkg.AssertErr(err, "", -1)
|
||||
id, err := utils.StringToInt(c.Param("tableId"))
|
||||
pkg.HasError(err, "", -1)
|
||||
table.TableId = id
|
||||
t1, err := template.ParseFiles("template/model.go.template")
|
||||
pkg.AssertErr(err, "", -1)
|
||||
pkg.HasError(err, "", -1)
|
||||
t2, err := template.ParseFiles("template/api.go.template")
|
||||
pkg.AssertErr(err, "", -1)
|
||||
pkg.HasError(err, "", -1)
|
||||
tab, _ := table.Get()
|
||||
var b1 bytes.Buffer
|
||||
err = t1.Execute(&b1, tab)
|
||||
@@ -29,7 +29,7 @@ func Preview(c *gin.Context) {
|
||||
mp := make(map[string]interface{})
|
||||
mp["template/model.go.template"] = b1.String()
|
||||
mp["template/api.go.template"] = b2.String()
|
||||
var res models.Response
|
||||
var res app.Response
|
||||
res.Data = mp
|
||||
|
||||
c.JSON(http.StatusOK, res.ReturnOK())
|
||||
|
||||
Reference in new issue
Block a user