package hdl import ( "applet/app/db" "applet/app/e" "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" "github.com/gin-gonic/gin" "html/template" "net/http" ) func ArticleHtml(c *gin.Context) { articleId := c.Query("article_id") if articleId == "" { e.OutErr(c, e.ERR_INVALID_ARGS) return } NewArticleDb := implement.NewArticleDb(db.Db) article, err := NewArticleDb.GetArticle(articleId) if err != nil { e.OutErr(c, e.ERR_DB_ORM) return } if article.Id == 0 { e.OutErr(c, e.ERR_NO_DATA) return } c.HTML(http.StatusOK, "article.html", gin.H{ "title": template.HTML(article.Title), "content": article.Content, }) }