diff --git a/controller/blog.go b/controller/blog.go index 4629609..97b545f 100644 --- a/controller/blog.go +++ b/controller/blog.go @@ -809,4 +809,29 @@ func DeleteDocTemplate(c *gin.Context) { resp.Data = nil resp.Msg = "OK" resp.Status = 0 +} + +func GetDocTemplateId(c *gin.Context) { + resp := RespBase{} + defer func() { + c.JSON(200, resp) + }() + sid := c.Param("id") + id,e := strconv.Atoi(sid) + if nil != e{ + log.Print(e.Error()) + return + } + ret,e := model.ReadDocTemplate(int32(id)) + if nil != e{ + log.Print(e.Error()) + return + } + if len(ret) > 0{ + resp.Data = ret[0] + }else{ + resp.Data = nil + } + resp.Msg = "OK" + resp.Status = 0 } \ No newline at end of file diff --git a/main.go b/main.go index 1673efc..461bf69 100644 --- a/main.go +++ b/main.go @@ -191,6 +191,8 @@ func main() { api.POST("/doc_template",controller.UpdateDocTemplate) api.POST("/get_doc_template",controller.GetDocTemplate) api.DELETE("/doc_template/:id",controller.DeleteDocTemplate) + api.GET("/doc_template/:id",controller.GetDocTemplateId) + } openapi := r.Group("openapi")