| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- package controller
- import (
- "git.wanbits.cc/sin/flytalk/models"
- "github.com/gin-gonic/gin"
- )
- func GetAbout(c *gin.Context) {
- page := c.Query("page")
- if page == "" {
- page = "index"
- }
- about := models.FindAboutByPage(page)
- c.JSON(200, gin.H{
- "code": 200,
- "msg": "ok",
- "result": about,
- })
- }
- func PostAbout(c *gin.Context) {
- title_cn := c.PostForm("title_cn")
- title_en := c.PostForm("title_en")
- keywords_cn := c.PostForm("keywords_cn")
- keywords_en := c.PostForm("keywords_en")
- desc_cn := c.PostForm("desc_cn")
- desc_en := c.PostForm("desc_en")
- css_js := c.PostForm("css_js")
- html_cn := c.PostForm("html_cn")
- html_en := c.PostForm("html_en")
- if title_cn == "" || title_en == "" || html_cn == "" || html_en == "" {
- c.JSON(200, gin.H{
- "code": 400,
- "msg": "error",
- })
- return
- }
- models.UpdateAbout("index", title_cn, title_en, keywords_cn, keywords_en, desc_cn, desc_en, css_js, html_cn, html_en)
- c.JSON(200, gin.H{
- "code": 200,
- "msg": "ok",
- "result": "",
- })
- }
|