package controller import ( "background/utils" "log" "github.com/gin-gonic/gin" ) type OpenApiController struct { } type DiffRequest struct { Origin string `json:"origin"` New string `json:"new"` } //from: 发送人邮箱 //to:接收邮件,可以是"290198252@qq.com;29019822@qq.com;2901982@qq.com" 邮箱之间用分号隔开 //template:模板名字 //content :网页模板的参数 key-value结构 //temp_data 模板内具体要替换的变量名字 Key-value结构 //generate 是否生成静态html func (this *OpenApiController) OndiffCallback(c *gin.Context) { var req DiffRequest var resp RespBase defer func() { c.JSON(200, resp) }() e := c.Bind(&req) if e != nil { log.Println(e.Error()) resp.Msg = "ParaErr" return } resp.Msg = "OK" } type ReqDDL struct { Data string `json:"data"` } func (this *OpenApiController) DDL2ORM(c *gin.Context) { var req ReqDDL resp := RespBase{ Msg: "err", } defer func() { c.JSON(200, resp) }() e := c.Bind(&req) if e != nil { log.Println(e.Error()) resp.Msg = "ParaErr" return } tbname, fields := utils.DDL2Field(req.Data) log.Print(tbname, fields) gocode := utils.CreateGoStruct(tbname,fields) resp.Data = gocode resp.Msg = "OK" resp.Status = 0 }