diff --git a/code.go b/code.go index 8157679..5227f62 100644 --- a/code.go +++ b/code.go @@ -181,7 +181,8 @@ var TptProject = Proj{ } this.Session(hotimeName+"_id", user.GetCeilInt("id")) this.Session(hotimeName+"_name", name) - this.Display(0, this.SessionId) + delete(user, "password") + this.Display(0, user) }, "logout": func(this *Context) { hotimeName := this.RouterString[0] diff --git a/example/app/analyse.go b/example/app/analyse.go index bd00d31..1395f07 100644 --- a/example/app/analyse.go +++ b/example/app/analyse.go @@ -374,23 +374,23 @@ var analyseCtr = Ctr{ res["upload_data"] = res.GetMap("upload_data") res["collect_data"] = res.GetMap("collect_data") res["collect_data"] = res.GetMap("collect_data") - if res.GetMap("collect_data") == nil && page == 1 { - go func(res Map, this *Context) { - path := "company/" + Md5(res.GetString("name")) + time.Now().Format("/200601021504.json") - - data := getCompany(res.GetString("name"), this.Config.GetString("tpt")+"/"+path) - - if len(data) != 0 { - data["path"] = path - this.Db.Update("company", Map{"collect_data": data.ToJsonString(), - "address": data.GetString("companyAddress"), - "sn": data.GetString("creditNo"), - "unit": data.GetString("authority"), - }, Map{"id": res.GetCeilInt("id")}) - res["collect_data"] = data - } - }(res, this) - } + //if res.GetMap("collect_data") == nil && page == 1 { + // go func(res Map, this *Context) { + // path := "company/" + Md5(res.GetString("name")) + time.Now().Format("/200601021504.json") + // + // data := getCompany(res.GetString("name"), this.Config.GetString("tpt")+"/"+path) + // + // if len(data) != 0 { + // data["path"] = path + // this.Db.Update("company", Map{"collect_data": data.ToJsonString(), + // "address": data.GetString("companyAddress"), + // "sn": data.GetString("creditNo"), + // "unit": data.GetString("authority"), + // }, Map{"id": res.GetCeilInt("id")}) + // res["collect_data"] = data + // } + // }(res, this) + //} } @@ -432,15 +432,19 @@ var analyseCtr = Ctr{ res["upload_data"] = res.GetMap("upload_data") res["collect_data"] = res.GetMap("collect_data") if res.GetMap("collect_data") == nil { - path := "company/" + Md5(res.GetString("name")) + time.Now().Format("/200601021504.json") + go func(res Map) { + path := "company/" + Md5(res.GetString("name")) + time.Now().Format("/200601021504.json") - data := getCompany(res.GetString("name"), this.Config.GetString("tpt")+"/"+path) + data := getCompany(res.GetString("name"), this.Config.GetString("tpt")+"/"+path) + + if len(data) != 0 { + data["path"] = path + this.Db.Update("company", Map{"collect_data": data.ToJsonString()}, Map{"id": res.GetCeilInt("id")}) + res["collect_data"] = data + } + + }(res) - if len(data) != 0 { - data["path"] = path - this.Db.Update("company", Map{"collect_data": data.ToJsonString()}, Map{"id": res.GetCeilInt("id")}) - res["collect_data"] = data - } } this.Display(0, res) diff --git a/example/app/user.go b/example/app/user.go index 6238370..5743dab 100644 --- a/example/app/user.go +++ b/example/app/user.go @@ -20,7 +20,7 @@ var User = Ctr{ }, "test": func(this *Context) { fmt.Println(this.SessionId) - //this.Session("user_id", 1) + this.Session("user_id", 1) wechat := this.Db.Get("wechat", "*") this.Session("wechatInfo", wechat) this.Display(0, "开始测试") @@ -33,8 +33,13 @@ var User = Ctr{ if this.Session("user_id").Data == nil { if this.Session("wechatInfo").Data != nil { - this.Display(6, "需要认证") - return + + wechat := this.Db.Get("wechat", "status", Map{"id": this.Session("wechatInfo").ToMap().GetCeilInt("id")}) + if wechat.GetCeilInt("status") == 0 { + this.Display(6, "需要认证") + return + } + } this.Display(2, "还没有登录") return diff --git a/example/iedc.exe b/example/iedc.exe index be7d504..50f3ad8 100644 Binary files a/example/iedc.exe and b/example/iedc.exe differ diff --git a/example/tpt/wx/index.html b/example/tpt/wx/index.html index 0961646..ab1860b 100644 --- a/example/tpt/wx/index.html +++ b/example/tpt/wx/index.html @@ -1 +1 @@ -政企超链接
\ No newline at end of file +政企超链接
\ No newline at end of file diff --git a/example/tpt/wx/js/hotime.js b/example/tpt/wx/js/hotime.js index 9af64d2..4decb0d 100644 --- a/example/tpt/wx/js/hotime.js +++ b/example/tpt/wx/js/hotime.js @@ -170,7 +170,7 @@ var H={ } // url= url+"."+type; } - if(url.indexOf('http')<0){ + if(url.indexOf('http')<0&&url.indexOf('/')!=0){ if(url.indexOf('.'+H.ctrType)>0) url= H.url+url; else diff --git a/example/tpt/wx/wx.html b/example/tpt/wx/wx.html index f4a6fe3..079299b 100644 --- a/example/tpt/wx/wx.html +++ b/example/tpt/wx/wx.html @@ -7,8 +7,19 @@