You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
493 B
Go
33 lines
493 B
Go
|
9 months ago
|
package controllers
|
||
|
|
|
||
|
|
import (
|
||
|
|
"fmt"
|
||
|
5 months ago
|
"weather_go/models"
|
||
|
9 months ago
|
|
||
|
|
"github.com/astaxie/beego"
|
||
|
|
_ "github.com/astaxie/beego/session/mysql"
|
||
|
|
)
|
||
|
|
|
||
|
|
type CMSController struct {
|
||
|
|
beego.Controller
|
||
|
|
}
|
||
|
|
|
||
|
|
func (c *CMSController) Get() {
|
||
|
|
|
||
|
|
c.TplName = "form.tpl"
|
||
|
|
}
|
||
|
|
|
||
|
|
func (c *CMSController) Post() {
|
||
|
|
u := models.User{}
|
||
|
|
if err := c.ParseForm(&u); err != nil {
|
||
|
|
c.Ctx.WriteString("jsoninfo is empty")
|
||
|
|
return
|
||
|
|
}
|
||
|
|
|
||
|
|
fmt.Println(u.Name)
|
||
|
|
fmt.Println(u.Age)
|
||
|
|
fmt.Println(u.Email)
|
||
|
|
|
||
|
|
c.Ctx.Output.Body([]byte("heleo"))
|
||
|
|
}
|