增加表关联新建功能,同时修复数据库bug

This commit is contained in:
2021-08-30 07:36:17 +08:00
parent e1f4876621
commit 62cf625fe9
10 changed files with 100 additions and 332 deletions
+23
View File
@@ -4,6 +4,7 @@ var InitTpt = `package {{name}}
import (
. "../../../hotime"
. "../../../hotime/common"
)
var ID = "{{id}}"
@@ -12,6 +13,28 @@ var ID = "{{id}}"
var Project = Proj{
//"user": UserCtr,
{{tablesCtr}}
"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("{{name}}","*",Map{"AND":Map{"name":name,"password":Md5(password)}})
if user==nil{
this.Display(5,"登录失败")
return
}
this.Session("id",user.GetCeilInt("id"))
this.Session("name",name)
this.Display(0,"登录成功")
},
"logout": func(this *Context) {
this.Session("id",nil)
this.Session("name",nil)
this.Display(0,"退出登录成功")
},
}
`
var CtrTpt = `package {{name}}