Kaynağa Gözat

feat:打印日志

wangshan 3 yıl önce
ebeveyn
işleme
c343ff5eb8
2 değiştirilmiş dosya ile 14 ekleme ve 8 silme
  1. 1 0
      src/jfw/front/front.go
  2. 13 8
      src/jfw/front/org_structure.go

+ 1 - 0
src/jfw/front/front.go

@@ -824,6 +824,7 @@ func (m *Front) Sess(ostr string) error {
 		} else {
 			ok, _, _ = FindUserAndCreateSess(openid, m.Session(), "wx", false)
 		}
+		log.Println("ok:", ok)
 		if ok {
 			actionurl := util.ObjToString(urlMap[str[3]])
 			if actionurl != "" {

+ 13 - 8
src/jfw/front/org_structure.go

@@ -61,15 +61,19 @@ func (this *OrgStructure) InvitationPage() error {
 	depId := this.GetString("depId")         //加密后-部门id
 	entId := this.GetString("entId")         //加密后-企业id
 	depcname := this.GetString("depcname")
-	registered := "0" //是否是剑鱼用户:0:未关注; 1:已关注
+	registered := "0"                                     //是否是剑鱼用户:0:未关注; 1:已关注
+	entUserId_str := util.SE.Decode4HexByCheck(entUserId) //解密
+	entUserId_sess := this.GetSession("entUserId")
 	OrgUrl := util.ObjToString(config.Sysconfig["wxOrgUrl"]) + "?entUserId=" + entUserId + "&depId=" + depId + "&entId=" + entId + "&depcname=" + depcname
 	if !mobileReg.MatchString(client) {
 		OrgUrl = util.ObjToString(config.Sysconfig["pcOrgUrl"]) + "?entUserId=" + entUserId + "&depId=" + depId + "&entId=" + entId + "&depcname=" + depcname
-	} else {
+	} else if entUserId_sess == nil || entUserId_sess.(string) != entUserId_str {
+		userId := util.ObjToString(this.Session().Get("userId"))
 		openId := util.ObjToString(this.Session().Get("s_m_openid"))
-		phone := ""
+		phone := util.ObjToString(this.Session().Get("phone"))
 		isSubscribe := false //是否关注
-		if openId == "" {
+		log.Println("openid:::::::::", openId)
+		if userId == "" {
 			if this.GetString("state") == "wx" {
 				//微信跳回来的
 				code := this.GetString("code")
@@ -81,6 +85,7 @@ func (this *OrgStructure) InvitationPage() error {
 				return this.Redirect(fmt.Sprintf(config.Wxoauth, url.QueryEscape(this.Site()+this.Url()), "wx"), 302)
 			}
 		}
+		log.Println("openid----------", openId)
 		if openId != "" {
 			isSubscribe = CheckUserIsSubscribe(openId)
 			if isSubscribe {
@@ -88,11 +93,11 @@ func (this *OrgStructure) InvitationPage() error {
 				FindUserAndCreateSess(openId, this.Session(), "wx", false)
 				phone = util.If(this.GetSession("phone") != nil, this.GetSession("phone"), "").(string)
 			}
-			if phone != "" {
-				phone = util.SE.EncodeString(phone)
-			}
-			OrgUrl = OrgUrl + "&openId=" + util.SE.EncodeString(openId) + "&phone=" + phone + "&registered=" + registered
 		}
+		if phone != "" {
+			phone = util.SE.EncodeString(phone)
+		}
+		OrgUrl = OrgUrl + "&openId=" + util.SE.EncodeString(openId) + "&phone=" + phone + "&registered=" + registered
 	}
 	return this.Redirect(OrgUrl)