2021-08-28 05:05:12 +00:00
|
|
|
package admin
|
|
|
|
|
|
|
|
import (
|
|
|
|
. "../../../hotime"
|
2021-08-29 23:36:17 +00:00
|
|
|
. "../../../hotime/common"
|
2021-08-28 05:05:12 +00:00
|
|
|
)
|
|
|
|
|
2021-09-15 20:33:10 +00:00
|
|
|
var ID = "7d33119d7fef7daa5b9be2e1c75e5392"
|
2021-08-28 05:05:12 +00:00
|
|
|
|
|
|
|
// Project 管理端项目
|
|
|
|
var Project = Proj{
|
|
|
|
//"user": UserCtr,
|
|
|
|
"admin": adminCtr,
|
|
|
|
"category": categoryCtr,
|
|
|
|
"ctg_order_date": ctg_order_dateCtr,
|
|
|
|
"order": orderCtr,
|
|
|
|
"org": orgCtr,
|
|
|
|
"role": roleCtr,
|
|
|
|
"user": userCtr,
|
2021-09-15 20:33:10 +00:00
|
|
|
|
2021-08-29 23:36:17 +00:00
|
|
|
"hotime": Ctr{
|
|
|
|
"login": func(this *Context) {
|
|
|
|
name := this.Req.FormValue("name")
|
|
|
|
password := this.Req.FormValue("password")
|
|
|
|
if name == "" || password == "" {
|
|
|
|
this.Display(3, "参数不足")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
user := this.Db.Get("admin", "*", Map{"AND": Map{"name": name, "password": Md5(password)}})
|
|
|
|
if user == nil {
|
|
|
|
this.Display(5, "登录失败")
|
|
|
|
return
|
|
|
|
}
|
2021-09-11 21:35:14 +00:00
|
|
|
this.Session("admin_id", user.GetCeilInt("id"))
|
|
|
|
this.Session("admin_name", name)
|
|
|
|
this.Display(0, this.SessionId)
|
2021-08-29 23:36:17 +00:00
|
|
|
},
|
|
|
|
"logout": func(this *Context) {
|
2021-09-11 21:35:14 +00:00
|
|
|
this.Session("admin_id", nil)
|
|
|
|
this.Session("admin_name", nil)
|
2021-08-29 23:36:17 +00:00
|
|
|
this.Display(0, "退出登录成功")
|
|
|
|
},
|
|
|
|
"info": func(that *Context) {
|
2021-09-11 21:35:14 +00:00
|
|
|
re := that.Db.Get("admin", that.MakeCode.Info("admin"), Map{"id": that.Session("admin_id").ToCeilInt()})
|
2021-08-29 23:36:17 +00:00
|
|
|
|
|
|
|
if re == nil {
|
|
|
|
that.Display(4, "找不到对应信息")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
for k, v := range re {
|
|
|
|
|
|
|
|
column := that.MakeCode.TableColumns["admin"][k]
|
|
|
|
if column == nil {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
if (column["list"] == nil || column.GetBool("list")) && column.GetString("link") != "" {
|
|
|
|
re[column.GetString("link")] = that.Db.Get(column.GetString("link"), column.GetString("value"), Map{"id": v})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
that.Display(0, re)
|
|
|
|
},
|
|
|
|
},
|
2021-08-28 05:05:12 +00:00
|
|
|
}
|