code review

master
taoshihan 2 months ago
parent b0e64b22fa
commit e0b23044a4

@ -95,18 +95,7 @@ func install() (bool, error) {
}
return true, nil
}
func MainCheckAuth(c *gin.Context) {
kefuName, _ := c.Get("kefu_name")
userinfo := models.FindUser(kefuName.(string))
c.JSON(200, gin.H{
"code": 200,
"msg": "验证成功",
"result": gin.H{
"avator": userinfo.Avator,
"name": userinfo.Name,
},
})
}
func GetStatistics(c *gin.Context) {
visitors := models.CountVisitors()
message := models.CountMessage(nil, nil)

@ -22,7 +22,7 @@ func InitApiRouter(engine *gin.Engine) {
}
engine.GET("/captcha", controller.GetCaptcha)
engine.POST("/check", controller.LoginCheckPass)
engine.POST("/check_auth", middleware.JwtApiMiddleware, controller.MainCheckAuth)
engine.GET("/userinfo", middleware.JwtApiMiddleware, controller.GetKefuInfoAll)
engine.POST("/register", middleware.Ipblack, controller.PostKefuRegister)
engine.POST("/install", controller.PostInstall)

@ -137,8 +137,8 @@
checkAuth(){
let _this=this;
$.ajax({
type:"post",
url:"/check_auth",
type:"GET",
url:"/kefuinfo",
headers:{
"token":localStorage.getItem("token")
},
@ -147,7 +147,6 @@
window.location.href="/login";
} else {
_this.adminAvator=data.result.avator;
_this.adminRole=data.result.role_name;
_this.iframeUrl = "/pannel";
}
}

Loading…
Cancel
Save