r:=gin.New()
r.GET("/", func(c *gin.Context) {
var cc SSHconfig
if err:=c.BindJSON(&cc);err!=nil{
log.Println(err)
}
var (
//u model.CoreAccount
p model.CoreGrained
//groupList []model.CoreRoleGroup
//s model.CoreGlobalConfiguration
)
model.DB().Debug().Select("`group`").Where("username =?", cc.Username).First(&p)
c.AbortWithStatusJSON(200,gin.H{"OK":true,"data":p.Group})
})
r.Run("127.0.0.1:8000")
}
只能在raw访问,有点想不明白?