Browse Source

Merge branch 'release' into dev4.6.1.1

luwenna 3 năm trước cách đây
mục cha
commit
3490cb7e56

+ 5 - 0
src/jfw/filter/pcfilter.go

@@ -8,6 +8,7 @@ import (
 	"net/http"
 	"qfw/util"
 	"qfw/util/redis"
+	"strings"
 	"time"
 
 	"github.com/go-xweb/httpsession"
@@ -33,6 +34,10 @@ func (this *pcFilter) Do() bool {
 		//wx
 		return true
 	}
+	//pc助手订阅消息、招标搜索两个菜单链接过滤掉
+	if strings.HasPrefix(this.R.RequestURI, "/jypc/toAct/") {
+		return true
+	}
 	href := "/?nol=1"
 	//对比session是否一致,不一致则清除掉sessionid
 	if uid := this.GetSession["userId"]; uid != nil && uid != "" {

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

@@ -641,6 +641,10 @@ func (f *Front) HasSign() error {
 
 //用户注销
 func (f *Front) SignOut() error {
+	userId, _ := f.GetSession("userId").(string)
+	if userId != "" {
+		redis.Del("other", jyutil.LoginRedisKey(userId))
+	}
 	f.DelSession("rpcBackUserInfo")
 	f.DelSession("user")
 	f.DelSession("s_nickname")

+ 37 - 40
src/jfw/front/pchelper.go

@@ -89,16 +89,14 @@ func (l *PcHelper) Login() error {
 				"s_phone":    phone,
 				"s_password": util.GetMd5String(password),
 			}
-			user, ok := mongodb.FindOne("user", query)
+			user, ok := mongodb.FindOneByField("user", query, `{"s_nickname":1}`)
 			//登录成功
 			if ok && user != nil && len(*user) > 0 {
-				if (*user)["s_phone"] != nil {
-					reOpenId = (*user)["s_phone"].(string)
-				}
+				reOpenId = phone
 				if (*user)["s_nickname"] != nil {
 					reNickname = (*user)["s_nickname"].(string)
-				} else if (*user)["s_phone"] != nil {
-					reNickname = (*user)["s_phone"].(string)
+				} else {
+					reNickname = phone
 				}
 				reToken = getUToken(mac, phone)
 				return 1
@@ -109,21 +107,20 @@ func (l *PcHelper) Login() error {
 			if phone == "" || l.GetSession("identCodeValue") == nil || l.GetString("identCode") != l.GetSession("identCodeValue") { //验证码不正确
 				return -1
 			} else {
-				query := map[string]interface{}{
+				datas, ok := mongodb.Find("user", map[string]interface{}{
 					"i_appid": 2,
-					"s_phone": phone,
-					//"i_type":  1,
-				}
-				user, ok := mongodb.FindOne("user", query)
+					"$or": []map[string]interface{}{
+						map[string]interface{}{"s_phone": phone},
+						map[string]interface{}{"s_m_phone": phone},
+					},
+				}, `{"s_phone":-1}`, `{"s_phone":1,"s_m_phone":1,"s_m_openid":1,"s_nickname":1}`, false, 0, 1)
 				if ok {
-					//用户不存在
-					if user == nil || len(*user) == 0 {
+					if datas == nil || len(*datas) == 0 { //不存在
 						data := map[string]interface{}{
 							//"i_type":        1, //手机注册
 							"i_source":      1, //pc助手注册 add 20181119
 							"i_appid":       2,
 							"i_ispush":      1,
-							"s_unique":      phone,
 							"s_phone":       phone,
 							"s_password":    "",
 							"l_registedate": time.Now().Unix(),
@@ -133,6 +130,7 @@ func (l *PcHelper) Login() error {
 								"i_ratemode":   2,
 								"l_modifydate": time.Now().Unix(),
 							},
+							"s_regsource": "pchelper",
 						}
 						_id := mongodb.Save("user", data)
 						if _id != "" {
@@ -143,14 +141,24 @@ func (l *PcHelper) Login() error {
 							return 1
 						}
 					} else {
+						updataMap := map[string]interface{}{}
+						if (*datas)[0]["s_m_phone"] != nil {
+							updataMap["s_phone"] = phone
+						}
+						if len(updataMap) > 0 {
+							mongodb.UpdateById("user", BsonIdToSId((*datas)[0]["_id"]), map[string]interface{}{
+								"$set":   updataMap,
+								"$unset": map[string]interface{}{"s_m_phone": ""},
+							})
+						}
 						jy.ClearPhoneIdentSession(l.Session())
-						if (*user)["s_m_openid"] != nil {
-							reOpenId = (*user)["s_m_openid"].(string)
+						if (*datas)[0]["s_m_openid"] != nil {
+							reOpenId = (*datas)[0]["s_m_openid"].(string)
 						}
-						if (*user)["s_nickname"] != nil {
-							reNickname = (*user)["s_nickname"].(string)
-						} else if (*user)["s_phone"] != nil {
-							reNickname = (*user)["s_phone"].(string)
+						if (*datas)[0]["s_nickname"] != nil {
+							reNickname = (*datas)[0]["s_nickname"].(string)
+						} else {
+							reNickname = phone
 						}
 						reToken = getUToken(mac, phone)
 						return 1
@@ -178,15 +186,13 @@ func (l *PcHelper) Login() error {
 					"i_appid": 2,
 					"s_phone": phone,
 				}
-				user, ok := mongodb.FindOne("user", query)
+				user, ok := mongodb.FindOneByField("user", query, `{"s_nickname":1}`)
 				if ok && user != nil && len(*user) > 0 {
-					if (*user)["s_phone"] != nil {
-						reOpenId = (*user)["s_phone"].(string)
-					}
+					reOpenId = phone
 					if (*user)["s_nickname"] != nil {
 						reNickname = (*user)["s_nickname"].(string)
-					} else if (*user)["s_phone"] != nil {
-						reNickname = (*user)["s_phone"].(string)
+					} else {
+						reNickname = phone
 					}
 					reToken = getUToken(mac, phone)
 					return 1
@@ -277,23 +283,14 @@ func (l *PcHelper) ToAct(token string) error {
 			if b {
 				if phone != "" && deMac != "" {
 					if len(phone) == 11 {
-						PcHelperLoginInfo(phone, l.Session())
+						//PcHelperLoginInfo(phone, l.Session())
+						CreateSession(map[string]interface{}{
+							"i_appid": 2,
+							"s_phone": phone,
+						}, l.Session(), "pchelper", true)
 					} else {
 						LoginInfo("", phone, l.Session())
 					}
-					sessUser := l.GetSession("user").(map[string]interface{})
-					if sessUser != nil {
-						if sessUser["s_nickname"] == nil || sessUser["s_nickname"] == "" {
-							hNickname := phone
-							if len(phone) == 11 {
-								hNickname = phone[0:3] + "****" + phone[7:]
-							}
-							sessUser["s_nickname"] = hNickname
-							l.SetSession("user", sessUser)
-							l.SetSession("nickname", hNickname)
-							l.SetSession("s_nickname", hNickname)
-						}
-					}
 					return l.Redirect("/jypc/" + act)
 				} else {
 					log.Println(logPrefix, "ToAct-token解析异常", "token:", token)

+ 1 - 1
src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/main_root.js

@@ -128,7 +128,7 @@ var vNode = {
                 if (url != 'javascript:;') {
                     JyObj.backUrl('H') // 直接返回首页
                 }
-            } else if (title == '招标订阅推送') {
+            } else if (title == '招标订阅推送'||title == '采购单位全景分析'||title == '招标附件下载') {
                 if (url != 'javascript:;') {
                     $.ajax({
                         url: '/publicapply/subscribe/vipSwitch',

+ 2 - 2
src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/main_root_data.js

@@ -97,7 +97,7 @@ var staticData = [
             {
                 id:5,
                 b_class:'isgray',
-                url:'/jyapp/big/page/big_subscribe',
+                url:'/jyapp/swordfish/historypush',
                 dis_url:'javascript:;',
                 b_gray_icon:'icon-gray-zhaobiaodt',
                 b_gold_icon:'icon-gold-zhaobiaodt',
@@ -157,7 +157,7 @@ var staticData = [
             {
                 id:3,
                 b_class:'isgray',
-                url:'/jyapp/big/page/big_subscribe',
+                url:'/jyapp/swordfish/historypush',
                 dis_url:'javascript:;',
                 b_gray_icon:'icon-gray-fjxiazai',
                 b_gold_icon:'icon-gold-zhaobiaofujianxiazai',