政企超链接开始集成
This commit is contained in:
+13
-12
@@ -4,6 +4,7 @@ import (
|
||||
. "../../../hotime"
|
||||
. "../../../hotime/cache"
|
||||
. "../../../hotime/common"
|
||||
"fmt"
|
||||
"github.com/silenceper/wechat"
|
||||
"github.com/silenceper/wechat/cache"
|
||||
"time"
|
||||
@@ -80,7 +81,7 @@ var Wechat = Ctr{
|
||||
//微信注册,0已经完整的注册了,1还没有注册
|
||||
"code": func(this *Context) {
|
||||
|
||||
//orgId:=ObjToInt(this.Req.FormValue("org_id"))
|
||||
orgId := ObjToInt(this.Req.FormValue("org_id"))
|
||||
//if orgId==0{
|
||||
// this.Display(3, "缺少组织id")
|
||||
// return
|
||||
@@ -96,7 +97,7 @@ var Wechat = Ctr{
|
||||
|
||||
//判断用户是否已经注册
|
||||
user := this.Db.Get("wechat", Map{"[><]user": "wechat.user_id=user.id"}, "user.id,user.state", Map{"openid": resToken.OpenID})
|
||||
if user != nil && user.GetCeilInt("state") == 0 {
|
||||
if user != nil && user.GetCeilInt("id") != 0 && user.GetCeilInt("state") == 0 {
|
||||
this.Session("user_id", user.Get("id"))
|
||||
this.Display(0, Map{"type": 0, "token": this.SessionId})
|
||||
return
|
||||
@@ -116,8 +117,12 @@ var Wechat = Ctr{
|
||||
"retoken": resToken.RefreshToken,
|
||||
"appid": this.Config.GetString("wechatAppID"),
|
||||
"unionid": userInfo.Unionid,
|
||||
//"nickname": userInfo.Nickname,
|
||||
//"avatar": userInfo.HeadImgURL,
|
||||
"nickname": userInfo.Nickname,
|
||||
"avatar": userInfo.HeadImgURL,
|
||||
}
|
||||
if orgId != 0 {
|
||||
wechatInfo["org_id"] = orgId
|
||||
wechatInfo["status"] = 0
|
||||
}
|
||||
|
||||
wechatDb := this.Db.Get("wechat", "*", Map{"openid": wechatInfo.GetString("openid")})
|
||||
@@ -130,15 +135,11 @@ var Wechat = Ctr{
|
||||
wechatInfo["create_time"] = t
|
||||
wechatInfo["id"] = this.Db.Insert("wechat", wechatInfo)
|
||||
}
|
||||
wechatDb = this.Db.Get("wechat", "*", Map{"openid": wechatInfo.GetString("openid")})
|
||||
|
||||
wechatInfo["nickname"] = userInfo.Nickname
|
||||
|
||||
wechatInfo["avatar"] = userInfo.HeadImgURL
|
||||
|
||||
//this.Session("user_id",user.GetCeilInt("id"))
|
||||
|
||||
this.Session("wechatInfo", wechatInfo)
|
||||
|
||||
this.Session("wechatInfo", wechatDb)
|
||||
fmt.Println(wechatDb)
|
||||
fmt.Println(this.Session("wechatInfo"))
|
||||
//this.Display(0, 1)
|
||||
this.Display(0, Map{"type": 1, "token": this.SessionId})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user