增加表关联新建功能,同时修复数据库bug
This commit is contained in:
@@ -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}}
|
||||
|
||||
Reference in New Issue
Block a user