WH01243 2 anni fa
parent
commit
b9b9649e31

+ 0 - 2
common/src/qfw/util/bidsearch/search.go

@@ -394,7 +394,6 @@ func PublicSearch(userId, selectType, publishtime string, bidSearchOldUserLimit
 	vipStatus := jy.GetVipState(public.Mysql, public.MQFW, userId)
 	isPayedUser := vipStatus.IsPayedUser()
 	queryItems := vipStatus.GetQueryItems(selectType, bidSearchOldUserLimit)
-
 	if publishtime == "" {
 		if isPayedUser {
 			publishtime = "fiveyear"
@@ -402,7 +401,6 @@ func PublicSearch(userId, selectType, publishtime string, bidSearchOldUserLimit
 			publishtime = "thisyear"
 		}
 	}
-
 	if isPayedUser {
 		//if currentPage > SearchMaxPageCount_PAYED {
 		//	currentPage = SearchMaxPageCount_PAYED

+ 12 - 27
common/src/qfw/util/jy/payUser.go

@@ -1,6 +1,7 @@
 package jy
 
 import (
+	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
 	"bytes"
 	"encoding/json"
 	"errors"
@@ -10,10 +11,7 @@ import (
 	"net/http"
 	"strings"
 
-	"app.yhyue.com/moapp/jybase/mongodb"
-
 	qu "app.yhyue.com/moapp/jybase/common"
-	"app.yhyue.com/moapp/jybase/mysql"
 )
 
 //是否是付费用户
@@ -24,39 +22,26 @@ type VipState struct {
 	registerData int64 //注册时间
 }
 
-func GetVipState(mysql *mysql.Mysql, mg mongodb.MongodbSim, userId string) (vs *VipState) {
+func GetVipState(appid string, session *httpsession.Session, host, key, userId string) (vs *VipState) {
 	vs = &VipState{}
 	if userId == "" {
 		return
 	}
-	phone := ""
-	data, ok := mg.FindById("user", userId, `"i_member_status":1,"i_vip_status":1,"s_m_phone":1,"s_phone":1,"o_vipjy":1,"l_registedate":1`)
-	if data != nil && len(*data) > 0 && ok {
-		i_vip_status := qu.IntAll((*data)["i_vip_status"])
+	//data, ok := mg.FindById("user", userId, `"i_member_status":1,"i_vip_status":1,"s_m_phone":1,"s_phone":1,"o_vipjy":1,"l_registedate":1`)
+	data := GetBigVipUserBaseMsg("10000", session, host, key)
+	if data != nil {
+		i_vip_status := data.Data.Vip.Status
 		if i_vip_status > 1 {
 			vs.VipState = 1
-			ovipjy, _ := (*data)["o_vipjy"].(map[string]interface{})
-			if ovipjy["o_buyset"] != nil {
-				o_buyset := ovipjy["o_buyset"].(map[string]interface{})
-				if o_buyset["upgrade"] != nil {
-					vs.VipState = 2
-				}
+			if data.Data.Vip.Upgrade > 0 {
+				vs.VipState = 2
 			}
 		}
-		if i_member_status := qu.IntAllDef((*data)["i_member_status"], 0); i_member_status > 0 {
-			vs.BigMember = i_member_status
-		}
-		if s_phone, _ := (*data)["s_phone"].(string); s_phone != "" {
-			phone = s_phone
-		} else if s_m_phone, _ := (*data)["s_m_phone"].(string); s_m_phone != "" {
-			phone = s_m_phone
-		}
-		if phone != "" {
-			if mysql.CountBySql(`select count(1) from entniche_user where phone = ? and power =1`, phone) > 0 {
-				vs.EntMember = 1
-			}
+		if i_member_status := data.Data.Member.Status; i_member_status > 0 {
+			vs.BigMember = qu.IntAll(i_member_status)
 		}
-		vs.registerData, _ = ((*data)["l_registedate"]).(int64)
+		vs.EntMember = qu.IntAll(data.Data.Entniche.Status)
+		vs.registerData = data.Data.Free.Registedate
 	}
 	return
 }

+ 1 - 0
common/src/qfw/util/jy/subScribe.go

@@ -95,6 +95,7 @@ func EntnicheSub(entUserId, entId int64, types int64, mg mongodb.MongodbSim) *ma
 	if types == 2 {
 		if (*res)["o_entniche"] != nil {
 			ojy := common.ObjToMap((*res)["o_jy"])
+			object = ojy
 			if (*ojy)["a_key"] != nil {
 				akey := common.ObjArrToMapArr((*ojy)["a_key"].([]interface{}))
 				(*object)["a_items"] = []map[string]interface{}{ //转换至和其它结构一致

+ 27 - 29
common/src/qfw/util/jy/switchService.go

@@ -1,10 +1,6 @@
 package jy
 
 import (
-	util "app.yhyue.com/moapp/jybase/common"
-	. "app.yhyue.com/moapp/jybase/mongodb"
-	"app.yhyue.com/moapp/jybase/mysql"
-
 	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
 )
 
@@ -30,14 +26,15 @@ type switchService struct {
  * @param mongodb
  * @return string 服务类型
  */
-func (s *switchService) Get(session *httpsession.Session, m MongodbSim) string {
-	userId, _ := session.Get("userId").(string)
+func (s *switchService) Get(session *httpsession.Session, appid, host, key string) string {
+	//userId, _ := session.Get("userId").(string)
 	v, _ := session.Get(s.SessionKey).(string)
-	u, ok := m.FindById("user", userId, `{"i_member_status":1,"i_vip_status":1}`)
-	if ok && u != nil {
-		if i_member_status := util.IntAll((*u)["i_member_status"]); v == s.Member && i_member_status > 0 {
+	data := GetBigVipUserBaseMsg(appid, session, host, key)
+	//u, ok := m.FindById("user", userId, `{"i_member_status":1,"i_vip_status":1}`)
+	if data != nil {
+		if i_member_status := data.Status; v == s.Member && i_member_status > 0 {
 			return s.Member
-		} else if i_vip_status := util.IntAll((*u)["i_vip_status"]); v == s.Vip && i_vip_status > 0 {
+		} else if i_vip_status := data.VipStatus; v == s.Vip && i_vip_status > 0 {
 			return s.Vip
 		} else if i_member_status > 0 {
 			session.Set(s.SessionKey, s.Member)
@@ -51,24 +48,25 @@ func (s *switchService) Get(session *httpsession.Session, m MongodbSim) string {
 	return s.Free
 }
 
-func (s *switchService) GetEntniche(session *httpsession.Session, m MongodbSim, sql *mysql.Mysql) string {
+func (s *switchService) GetEntniche(session *httpsession.Session, appid, host, key string) string {
 	sessMap := session.GetMultiple()
-	userId, _ := sessMap["userId"].(string)
+	//userId, _ := sessMap["userId"].(string)
 	v, _ := sessMap[s.SessionKey].(string)
-	u, ok := m.FindById("user", userId, `{"i_member_status":1,"i_vip_status":1}`)
-	entniche := false
-	if entId, entUserId := util.IntAll(sessMap["entId"]), util.IntAll(sessMap["entUserId"]); entId > 0 && entUserId > 0 {
-		//当前企业是否购买商机管理
-		if sql.CountBySql(`SELECT count(1) as count FROM entniche_info a inner join entniche_user b on (a.id=? and a.status=1 and ifnull(a.power_source,0)=0 and b.id=? and b.power=1)`, entId, entUserId) > 0 {
-			entniche = true
-		}
-	}
-	if ok && u != nil {
-		if i_member_status := util.IntAll((*u)["i_member_status"]); v == s.Member && i_member_status > 0 {
+	//u, ok := m.FindById("user", userId, `{"i_member_status":1,"i_vip_status":1}`)
+	data := GetBigVipUserBaseMsg(appid, session, host, key)
+	/* if entId, entUserId := util.IntAll(sessMap["entId"]), util.IntAll(sessMap["entUserId"]); entId > 0 && entUserId > 0 {
+		      //当前企业是否购买商机管理
+		      if sql.CountBySql(`SELECT count(1) as count FROM entniche_info a inner join entniche_user b on (a.id=? and a.status=1 and ifnull(a.power_source,0)=0 and b.id=? and b.power=1)`, entId, entUserId) > 0 {
+			    entniche = true
+		      }
+	        }*/
+	entniche := data.Data.Entniche.Status > 0
+	if data != nil {
+		if i_member_status := data.Status; v == s.Member && i_member_status > 0 {
 			return s.Member
 		} else if v == s.Entniche && entniche {
 			return s.Entniche
-		} else if i_vip_status := util.IntAll((*u)["i_vip_status"]); v == s.Vip && i_vip_status > 0 {
+		} else if i_vip_status := data.VipStatus; v == s.Vip && i_vip_status > 0 {
 			return s.Vip
 		} else if i_member_status > 0 {
 			session.Set(s.SessionKey, s.Member)
@@ -86,16 +84,16 @@ func (s *switchService) GetEntniche(session *httpsession.Session, m MongodbSim,
 }
 
 //所选服务是否是大会员
-func (s *switchService) IsMember(session *httpsession.Session, m MongodbSim, sql *mysql.Mysql) bool {
-	return s.GetEntniche(session, m, sql) == s.Member
+func (s *switchService) IsMember(session *httpsession.Session, appid, host, key string) bool {
+	return s.GetEntniche(session, appid, host, key) == s.Member
 }
 
 //所选服务是否是超级订阅
-func (s *switchService) IsVip(session *httpsession.Session, m MongodbSim) bool {
-	return s.Get(session, m) == s.Vip
+func (s *switchService) IsVip(session *httpsession.Session, appid, host, key string) bool {
+	return s.Get(session, appid, host, key) == s.Vip
 }
 
 //所选服务是否是免费
-func (s *switchService) IsFree(session *httpsession.Session, m MongodbSim) bool {
-	return s.Get(session, m) == s.Free
+func (s *switchService) IsFree(session *httpsession.Session, appid, host, key string) bool {
+	return s.Get(session, appid, host, key) == s.Free
 }