优化整体

This commit is contained in:
hoteas
2022-03-13 01:48:54 +08:00
parent ac027c6e42
commit 8befd195c0
22 changed files with 312 additions and 289 deletions
+15 -15
View File
@@ -166,29 +166,29 @@ var TptProject = Proj{
},
},
"hotime": Ctr{
"login": func(this *Context) {
hotimeName := this.RouterString[0]
name := this.Req.FormValue("name")
password := this.Req.FormValue("password")
"login": func(that *Context) {
hotimeName := that.RouterString[0]
name := that.Req.FormValue("name")
password := that.Req.FormValue("password")
if name == "" || password == "" {
this.Display(3, "参数不足")
that.Display(3, "参数不足")
return
}
user := this.Db.Get(hotimeName, "*", Map{"AND": Map{"OR": Map{"name": name, "phone": name}, "password": Md5(password)}})
user := that.Db.Get(hotimeName, "*", Map{"AND": Map{"OR": Map{"name": name, "phone": name}, "password": Md5(password)}})
if user == nil {
this.Display(5, "登录失败")
that.Display(5, "登录失败")
return
}
this.Session(hotimeName+"_id", user.GetCeilInt("id"))
this.Session(hotimeName+"_name", name)
that.Session(hotimeName+"_id", user.GetCeilInt("id"))
that.Session(hotimeName+"_name", name)
delete(user, "password")
this.Display(0, user)
that.Display(0, user)
},
"logout": func(this *Context) {
hotimeName := this.RouterString[0]
this.Session(hotimeName+"_id", nil)
this.Session(hotimeName+"_name", nil)
this.Display(0, "退出登录成功")
"logout": func(that *Context) {
hotimeName := that.RouterString[0]
that.Session(hotimeName+"_id", nil)
that.Session(hotimeName+"_name", nil)
that.Display(0, "退出登录成功")
},
"info": func(that *Context) {
hotimeName := that.RouterString[0]