完成文章模板功能

master
DESKTOP-4RNDQIC\29019 2021-03-27 13:58:44 +08:00
parent 33e10b99ab
commit bf9fe046ee
2 changed files with 27 additions and 0 deletions

View File

@ -810,3 +810,28 @@ func DeleteDocTemplate(c *gin.Context) {
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
}

View File

@ -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")