Forráskód Böngészése

Merge branch 'feature/v4.10.31' of https://jygit.jydev.jianyu360.cn/qmx/jy into feature/v4.10.31

wangshan 4 napja
szülő
commit
fdbdcceea9

+ 2 - 2
src/jfw/front/classificationTag.go

@@ -417,7 +417,7 @@ func RecommendationBeacon() []Signal {
 			_, _, lists := bidsearch.GetPcBidSearchData("", "", "", publishTime, vst, "", "", "", "", "", "", "", "", 1, false, nil, bidSearch_field_1, "", false, false, "", 8, "")
 			if lists != nil {
 				for _, v1 := range *lists {
-					v1["_id"] = encrypt.CommonEncodeArticle("content", v1["_id"].(string))
+					v1["_id"] = encrypt.EncodeArticleId2ByCheck(v1["_id"].(string))
 					delete(v1, "toptype")
 					delete(v1, "s_subscopeclass")
 					tmpdate := v1["publishtime"]
@@ -580,7 +580,7 @@ func NewIndexbids(session *httpsession.Session, r *http.Request) []map[string]in
 	_, _, lists := bidsearch.GetPcBidSearchData("", "", "", publishTime, "招标预告,招标公告,招标结果,招标信用信息", "", "", "", "", "", "", "", "", 1, false, nil, bidSearch_field_1, "", false, false, "", 8, "")
 	if lists != nil {
 		for _, v1 := range *lists {
-			v1["_id"] = encrypt.CommonEncodeArticle("content", v1["_id"].(string))
+			v1["_id"] = encrypt.EncodeArticleId2ByCheck(v1["_id"].(string))
 			delete(v1, "toptype")
 			delete(v1, "s_subscopeclass")
 			tmpdate := v1["publishtime"]

+ 2 - 2
src/jfw/front/pcIndex.go

@@ -350,7 +350,7 @@ func GetNewArticle(typ int, pageSize int) (list []map[string]interface{}) {
 				*lists = (*lists)[0:6]
 				for _, v := range *lists {
 					// v["_id"] = EncodeArticleId2ByCheck(v["_id"].(string))
-					v["_id"] = encrypt.CommonEncodeArticle("indexcontent", v["_id"].(string))
+					v["_id"] = encrypt.EncodeArticleId2ByCheck(v["_id"].(string))
 					delete(v, "toptype")
 					delete(v, "s_subscopeclass")
 					tmpdate := v["publishtime"]
@@ -646,7 +646,7 @@ func (f *PcIndex) SearchResult(at, name string) error {
 			}
 			if datas != nil && len(*datas) > 0 {
 				for _, v := range *datas {
-					v["_id"] = encrypt.CommonEncodeArticle("content", util.ObjToString(v["_id"]))
+					v["_id"] = encrypt.EncodeArticleId2ByCheck(util.ObjToString(v["_id"]))
 				}
 			}
 		} else {

+ 2 - 2
src/jfw/front/shorturl.go

@@ -636,7 +636,7 @@ func (s *Short) LoginCommon(sess map[string]interface{}, stype, id string, bm bo
 		//免费用户浏览三级页判断留资与浏览次数
 		//indust := s.GetString("industry")
 		if userId != "" && stype == "indexcontent" { //已登录用户直接跳转至正常三级页
-			return s.Redirect(fmt.Sprintf("/article/content/%s.html", encrypt.CommonEncodeArticle("content", sid)))
+			return s.Redirect(fmt.Sprintf("/article/content/%s.html", encrypt.EncodeArticleId2ByCheck(sid)))
 		}
 		if stype == "advancedProject" {
 			//判断此用户是否有打开的权限
@@ -1078,7 +1078,7 @@ func (s *Short) Qr(t, id string) error {
 	}
 	///article/bdprivate/BXXXX 详情页
 	if strings.Contains(s.Refer(), "bdprivate") {
-		bdprivateId := encrypt.CommonEncodeArticle("content", encrypt.CommonDecodeArticle("bdprivate", id)[0])
+		bdprivateId := encrypt.EncodeArticleId2ByCheck(encrypt.CommonDecodeArticle("bdprivate", id)[0])
 		if bdprivateId != "" {
 			id = bdprivateId
 		}

+ 2 - 2
src/jfw/front/tags.go

@@ -489,7 +489,7 @@ func (this *Tags) GetNewBidInfo() (list []map[string]interface{}) {
 				*lists = (*lists)[:10]
 			}
 			for _, v := range *lists {
-				v["_id"] = encrypt.CommonEncodeArticle("content", v["_id"].(string))
+				v["_id"] = encrypt.EncodeArticleId2ByCheck(v["_id"].(string))
 				delete(v, "toptype")
 				delete(v, "s_subscopeclass")
 				tmpdate := v["publishtime"]
@@ -791,7 +791,7 @@ func (this *Tags) GetBidding(industry, area, city, stype, keyword string, reques
 			}
 			if datas != nil && len(*datas) > 0 {
 				for _, v := range *datas {
-					v["_id"] = encrypt.CommonEncodeArticle("content", qu.ObjToString(v["_id"]))
+					v["_id"] = encrypt.EncodeArticleId2ByCheck(qu.ObjToString(v["_id"]))
 					v["date"] = time.Unix(qu.Int64All(v["publishtime"]), 0).Format(date.Date_Short_Layout)
 					highlight, _ := v["highlight"].(map[string][]string)
 					detail := ""

+ 1 - 1
src/jfw/modules/app/src/app/jyutil/tags.go

@@ -538,7 +538,7 @@ func (b *BiddingInfo) DataFormat(data []map[string]interface{}) (bList []*InfoLi
 		for _, v := range data {
 			bl := &InfoList{
 				Title:   qu.ObjToString(v["title"]),
-				Url:     fmt.Sprintf("/nologin/content/%s.html", encrypt.CommonEncodeArticle("content", qu.ObjToString(v["_id"]))),
+				Url:     fmt.Sprintf("/nologin/content/%s.html", encrypt.EncodeArticleId2ByCheck(qu.ObjToString(v["_id"]))),
 				Area:    qu.ObjToString(v["area"]),
 				Subtype: qu.ObjToString(v["subtype"]),
 				Site:    qu.If(qu.ObjToString(v["site"]) == "剑鱼信息发布平台", "用户发布", "").(string),

+ 1 - 1
src/jfw/modules/publicapply/src/detail/dao/rightSide.go

@@ -26,7 +26,7 @@ func GetNewBidInfo() (list []map[string]interface{}) {
 		if lists != nil && len(*lists) > 10 {
 			*lists = (*lists)[0:10]
 			for _, v := range *lists {
-				v["_id"] = encrypt.CommonEncodeArticle("content", v["_id"].(string))
+				v["_id"] = encrypt.EncodeArticleId2ByCheck(v["_id"].(string))
 				tmpDate := v["publishtime"]
 				v["date"] = date.FormatDateWithObj(&tmpDate, date.Date_Short_Layout)
 			}

+ 7 - 8
src/jfw/modules/publicapply/src/subscribe/entity/entity.go

@@ -4,7 +4,6 @@ import (
 	qutil "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/encrypt"
 	elastic "app.yhyue.com/moapp/jybase/es"
-	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
 	"app.yhyue.com/moapp/jybase/redis"
 	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
 	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
@@ -36,13 +35,13 @@ const (
 var stringArr = []string{}
 
 type ParamInfo struct {
-	UserId  string
-	Session *httpsession.Session
-	Rx      *regexp.Regexp
+	UserId     string
+	SessionMap map[string]interface{}
+	Rx         *regexp.Regexp
 }
 
-func NewParamInfo(userId string, session *httpsession.Session) *ParamInfo {
-	return &ParamInfo{userId, session, regexp.MustCompile("\n+")}
+func NewParamInfo(userId string, sessionMap map[string]interface{}) *ParamInfo {
+	return &ParamInfo{userId, sessionMap, regexp.MustCompile("\n+")}
 }
 
 // dev4.6.3.21 暂不调用
@@ -77,7 +76,7 @@ func (this *ParamInfo) SetAreaByOneProvince() (b bool) {
 		ok := false
 		ok = config.Compatible.Update(this.UserId, map[string]interface{}{"$set": setMap})
 		if ok {
-			positionId := fmt.Sprint(qutil.Int64All(this.Session.Get("positionId")))
+			positionId := fmt.Sprint(qutil.Int64All(this.SessionMap["positionId"]))
 			jy.ClearBigVipUserPower(positionId)
 			config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
 				PositionId: positionId,
@@ -103,7 +102,7 @@ func (this *ParamInfo) IsSub() (bool, string, map[string]map[string][]string) {
 		productType = "vip"
 	}
 	if mData != nil && len(*mData) != 0 {
-		positionType := gconv.Int64(this.Session.Get("positionType"))
+		positionType := gconv.Int64(this.SessionMap["positionType"])
 		if positionType == 1 {
 			//企业身份
 			return false, productType, regionMap

+ 9 - 7
src/jfw/modules/publicapply/src/subscribe/service/action.go

@@ -6,11 +6,13 @@ import (
 
 type ServiceStruct struct {
 	*xweb.Action
-	subscribeMsg     xweb.Mapper `xweb:"/free/subscribe"`      //获取用户订阅信息
-	getPushCount     xweb.Mapper `xweb:"/free/pushcount"`      //推送结果预览 计数
-	getPushView      xweb.Mapper `xweb:"/free/pushview"`       //推送结果预览
-	getPushCountitem xweb.Mapper `xweb:"/free/pushcountitem"`  //单组推送结果预览 计数
-	areaPackEndTip   xweb.Mapper `xweb:"/free/areapack/(.*)"`  //省份订阅包到期提醒
-	oneProvinceSet   xweb.Mapper `xweb:"/free/oneProvinceSet"` //免费老用户点击去升级订阅设置 一个省份的 自动带入新设置
-	isSub            xweb.Mapper `xweb:"/subscribe/isSub"`     //是否订阅
+	subscribeMsg     xweb.Mapper `xweb:"/free/subscribe"`             //获取用户订阅信息
+	getPushCount     xweb.Mapper `xweb:"/free/pushcount"`             //推送结果预览 计数
+	getPushView      xweb.Mapper `xweb:"/free/pushview"`              //推送结果预览
+	getPushCountitem xweb.Mapper `xweb:"/free/pushcountitem"`         //单组推送结果预览 计数
+	areaPackEndTip   xweb.Mapper `xweb:"/free/areapack/(.*)"`         //省份订阅包到期提醒
+	oneProvinceSet   xweb.Mapper `xweb:"/free/oneProvinceSet"`        //免费老用户点击去升级订阅设置 一个省份的 自动带入新设置
+	isSub            xweb.Mapper `xweb:"/subscribe/isSub"`            //是否订阅
+	freePositionList xweb.Mapper `xweb:"/subscribe/freePositionList"` //免费职位id列表
+	checkAllFree     xweb.Mapper `xweb:"/subscribe/checkAllFree"`     //是否全是免费职位
 }

+ 115 - 5
src/jfw/modules/publicapply/src/subscribe/service/service.go

@@ -3,10 +3,16 @@ package service
 import (
 	. "app.yhyue.com/moapp/jybase/api"
 	qu "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/encrypt"
+	"app.yhyue.com/moapp/jybase/mongodb"
 	"fmt"
+	"github.com/gogf/gf/v2/frame/g"
 	"github.com/gogf/gf/v2/util/gconv"
 	"jy/src/jfw/modules/publicapply/src/config"
+	. "jy/src/jfw/modules/publicapply/src/config"
+	"jy/src/jfw/modules/publicapply/src/db"
 	"jy/src/jfw/modules/publicapply/src/subscribe/entity"
+	"jy/src/jfw/modules/publicapply/src/util"
 	"strings"
 )
 
@@ -17,7 +23,7 @@ func (this *ServiceStruct) OneProvinceSet() {
 		if this.Method() != "POST" {
 			return Result{Data: nil, Error_msg: Error_msg_1005}
 		}
-		newFN := entity.NewParamInfo(userId, this.Session())
+		newFN := entity.NewParamInfo(userId, this.Session().GetMultiple())
 		return Result{Data: newFN.SetAreaByOneProvince()}
 	}()
 	this.ServeJson(r)
@@ -29,7 +35,7 @@ func (this *ServiceStruct) IsSub() {
 		if this.Method() != "POST" {
 			return Result{Data: nil, Error_msg: Error_msg_1005}
 		}
-		newFN := entity.NewParamInfo(userId, this.Session())
+		newFN := entity.NewParamInfo(userId, this.Session().GetMultiple())
 		isSubscribe, productType, area := newFN.IsSub()
 		returnData := map[string]interface{}{
 			"frequentContinuous": config.Config.FrequentContinuous,
@@ -46,13 +52,26 @@ func (this *ServiceStruct) IsSub() {
 }
 
 func (this *ServiceStruct) SubscribeMsg() {
-	userId, _ := this.GetSession("userId").(string)
+	var (
+		sessionMap = this.Session().GetMultiple()
+		userId     = gconv.String(sessionMap["userId"])
+		entId      = gconv.Int64(sessionMap["entId"])
+	)
 	defer qu.Catch()
 	r := func() Result {
 		if this.Method() != "POST" {
 			return Result{Data: nil, Error_msg: Error_msg_1005}
 		}
-		newFN := entity.NewParamInfo(userId, this.Session())
+		//校验是否剑鱼员工
+		if entId == g.Cfg().MustGet(this.Request.Context(), "powerEntId", 25917).Int64() && strings.Index(this.Refer(), "/free/help/set_subscribe") > -1 {
+			if helpUserId := this.Cookie("usrDewkYanV3"); helpUserId != "" {
+				if identityInfo := util.HelpSubscribeDecode(helpUserId); identityInfo.UserId != "" {
+					userId = identityInfo.UserId
+					sessionMap = g.Map{"userId": identityInfo.UserId}
+				}
+			}
+		}
+		newFN := entity.NewParamInfo(userId, sessionMap)
 		return Result{Data: newFN.GetSubMsg()}
 	}()
 	this.ServeJson(r)
@@ -98,7 +117,7 @@ func (this *ServiceStruct) AreaPackEndTip(types string) {
 	userId, _ := this.GetSession("userId").(string)
 	defer qu.Catch()
 	r := func() Result {
-		newFN := entity.NewParamInfo(userId, this.Session())
+		newFN := entity.NewParamInfo(userId, this.Session().GetMultiple())
 		switch types {
 		case "tip":
 			return Result{Data: newFN.AreaPackTip()}
@@ -109,3 +128,94 @@ func (this *ServiceStruct) AreaPackEndTip(types string) {
 	}()
 	this.ServeJson(r)
 }
+
+// FreePositionList P775帮免费用户设置订阅条件
+func (this *ServiceStruct) FreePositionList() {
+	var (
+		sessionMap = this.Session().GetMultiple()
+		phone      = this.GetString("phone")
+		entId      = gconv.Int64(sessionMap["entId"])
+	)
+	defer qu.Catch()
+	r := func() Result {
+		//校验是否剑鱼员工
+		if entId != g.Cfg().MustGet(this.Request.Context(), "powerEntId", 25917).Int64() {
+			return Result{-1, "暂无权限", nil}
+		}
+		if phone == "" {
+			return Result{-1, "缺少参数", nil}
+		}
+		uData, _ := db.Mgo.FindOne("user", map[string]interface{}{"$or": []map[string]interface{}{{"s_phone": phone}, {"s_m_phone": phone}}})
+		if uData == nil || len(*uData) == 0 {
+			return Result{-1, "暂无用户信息", nil}
+		}
+		var (
+			base_user_id     = gconv.Int64((*uData)["base_user_id"])
+			login_positionid = gconv.Int64((*uData)["login_positionid"])
+			mgoUserId        = mongodb.BsonIdToSId((*uData)["_id"])
+			identitys        = []map[string]interface{}{}
+		)
+		list := Middleground.UserCenter.IdentityList(base_user_id)
+		for _, v := range list {
+			checked := 0
+			if login_positionid == v.PositionId {
+				checked = 1
+			}
+			userInfo := Middleground.PowerCheckCenter.Check("10000", mgoUserId, base_user_id, v.AccountId, v.EntId, v.PositionType, v.PositionId)
+			//过滤付费用户
+			if userInfo.Member.Status > 0 || userInfo.Vip.Status > 0 || userInfo.Entniche.Status > 0 {
+				continue
+			}
+			identitys = append(identitys, map[string]interface{}{
+				"checked":      checked,
+				"name":         v.Name,
+				"entId":        encrypt.SE.Encode2HexByCheck(fmt.Sprint(v.EntId)),
+				"positionType": v.PositionType,
+				"token": util.HelpSubscribeEncode(&util.HelpSubscribe{
+					PersonId:     v.PersonId,
+					UserId:       qu.If(v.PositionType == 0, mgoUserId, fmt.Sprintf("%d", v.PositionId)).(string),
+					PositionType: gconv.Int(v.PositionType),
+					EntId:        gconv.Int(v.EntId),
+					EntUserId:    gconv.Int(v.EntUserId),
+					MgoUserId:    mgoUserId,
+					BaseUserId:   gconv.Int(base_user_id),
+				}),
+			})
+		}
+		return Result{Data: identitys}
+	}()
+	this.ServeJson(r)
+}
+
+func (this *ServiceStruct) CheckAllFree() {
+	var (
+		sessionMap = this.Session().GetMultiple()
+		phone      = this.GetString("phone")
+		entId      = gconv.Int64(sessionMap["entId"])
+	)
+	defer qu.Catch()
+	r := func() Result {
+		//校验是否剑鱼员工
+		if entId != g.Cfg().MustGet(this.Request.Context(), "powerEntId", 25917).Int64() {
+			return Result{-1, "暂无权限", nil}
+		}
+		uData, _ := db.Mgo.FindOne("user", map[string]interface{}{"$or": []map[string]interface{}{{"s_phone": phone}, {"s_m_phone": phone}}})
+		if uData == nil || len(*uData) == 0 {
+			return Result{-1, "暂无用户信息", nil}
+		}
+		var (
+			base_user_id = gconv.Int64((*uData)["base_user_id"])
+			mgoUserId    = mongodb.BsonIdToSId((*uData)["_id"])
+		)
+		list := Middleground.UserCenter.IdentityList(base_user_id)
+		for _, v := range list {
+			userInfo := Middleground.PowerCheckCenter.Check("10000", mgoUserId, base_user_id, v.AccountId, v.EntId, v.PositionType, v.PositionId)
+			//过滤付费用户
+			if userInfo.Member.Status > 0 || userInfo.Vip.Status > 0 || userInfo.Entniche.Status > 0 {
+				return Result{Data: false}
+			}
+		}
+		return Result{Data: true}
+	}()
+	this.ServeJson(r)
+}

+ 35 - 0
src/jfw/modules/publicapply/src/subscribePush/entity/guide.go

@@ -0,0 +1,35 @@
+package entity
+
+import (
+	"github.com/gogf/gf/v2/util/gconv"
+	"jy/src/jfw/modules/publicapply/src/config"
+)
+
+// FreeIsInTsGuide 2有向导 1跳过向导
+// changeType 1修改订阅次 2设置修改城市
+func FreeIsInTsGuide(userid string, changeType int) int {
+	data := config.Compatible.Select(userid, `{"o_jy":1,"i_ts_guide":1,"l_registedate":1}`)
+	if data == nil || len(*data) == 0 {
+		return 0
+	}
+	var (
+		o_jy       = gconv.Map((*data)["o_jy"])
+		i_ts_guide = gconv.Int64((*data)["i_ts_guide"])
+		a_key      = gconv.Interfaces(o_jy["a_key"])
+		o_area     = gconv.Map(o_jy["o_area"])
+		o_area_p   = gconv.Map(o_jy["o_area_p"])
+	)
+	if i_ts_guide == 1 {
+		return 0
+	}
+	if len(o_jy) == 0 {
+		return 2
+	}
+	if (a_key == nil || len(a_key) == 0) && changeType != 1 {
+		return 2
+	}
+	if ((o_area == nil || len(o_area) == 0) && ((o_area_p == nil) || len(o_area_p) == 0)) && changeType != 2 {
+		return 2
+	}
+	return 1
+}

+ 80 - 73
src/jfw/modules/publicapply/src/subscribePush/entity/keyWords.go

@@ -15,7 +15,6 @@ import (
 	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
 
 	qutil "app.yhyue.com/moapp/jybase/common"
-	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
 	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
 
 	"go.mongodb.org/mongo-driver/bson"
@@ -37,11 +36,11 @@ type KeyWordsSet struct {
 	DeleteKey     string   //删除的关键词 json字符串{"0":"1,2","2":"0,3"} key:分类名称索引  value:分类名称下的关键词索引
 	EntId         int
 	EntUserId     int
-	Session       *httpsession.Session
+	SessionMap    map[string]interface{}
 }
 
 func (this *KeyWordsSet) UpdateKeyWords() map[string]interface{} {
-	power := jy.GetBigVipUserBaseMsg(this.Session, *config.Middleground)
+	power := jy.GetBigVipUserBaseMsgBySessVal(this.SessionMap, *config.Middleground)
 	if this.Type == "m" && power.Status < 0 {
 		return map[string]interface{}{"flag": false, "msg": "暂无权限"}
 	}
@@ -55,33 +54,33 @@ func (this *KeyWordsSet) UpdateKeyWords() map[string]interface{} {
 	if this.Type != "f" && (power.Status > 0 || power.VipStatus > 0) {
 		switch this.ActionType {
 		case "SK": //保存/修改关键词
-			return AddKeyWords(types, this.UserId, this.ClassifyIndex, this.ClassifyName, this.KeyWordIndex, this.KeyWordName, this.KeyWordsCount, this.NotKeyWord, this.AppendKeyWord, this.MatchWay, this.Session, this.Matchmode)
+			return AddKeyWords(types, this.UserId, this.ClassifyIndex, this.ClassifyName, this.KeyWordIndex, this.KeyWordName, this.KeyWordsCount, this.NotKeyWord, this.AppendKeyWord, this.MatchWay, this.SessionMap, this.Matchmode)
 		case "DK": //删除关键词
-			return DeleteKeyWords(types, this.DeleteKey, this.UserId, this.Session)
+			return DeleteKeyWords(types, this.DeleteKey, this.UserId, this.SessionMap)
 		case "SC": //保存/修改分类
-			return AddClass(types, this.ClassifyIndex, this.ClassifyName, this.UserId, this.Session)
+			return AddClass(types, this.ClassifyIndex, this.ClassifyName, this.UserId, this.SessionMap)
 		case "DC": //删除分类
-			return DeleteClass(types, this.ClassifyIndex, this.UserId, this.Session)
+			return DeleteClass(types, this.ClassifyIndex, this.UserId, this.SessionMap)
 		case "directSubKWS": //搜索列表直接订阅关键词
-			return directSubKWS(types, this.KeyWordName, this.UserId, this.Session, this.MatchWay)
+			return directSubKWS(types, this.KeyWordName, this.UserId, this.SessionMap, this.MatchWay)
 		}
 	} else {
 		this.ClassifyIndex = "0"
 		this.ClassifyName = "未分类"
 		switch this.ActionType {
 		case "SK": //保存/修改关键词
-			return AddKeyWordsFree(types, this.UserId, this.ClassifyIndex, this.ClassifyName, this.KeyWordIndex, this.KeyWordName, this.KeyWordsCount, this.NotKeyWord, this.AppendKeyWord, this.MatchWay, this.Session)
+			return AddKeyWordsFree(types, this.UserId, this.ClassifyIndex, this.ClassifyName, this.KeyWordIndex, this.KeyWordName, this.KeyWordsCount, this.NotKeyWord, this.AppendKeyWord, this.MatchWay, this.SessionMap)
 		case "DK": //删除关键词
-			return DeleteKeyWordsFree(types, this.DeleteKey, this.Session)
+			return DeleteKeyWordsFree(types, this.DeleteKey, this.SessionMap)
 		case "directSubKWS": //搜索列表直接订阅关键词
-			return directSubKWSFree(types, this.KeyWordName, this.Session)
+			return directSubKWSFree(types, this.KeyWordName, this.SessionMap)
 		}
 	}
 	return map[string]interface{}{"flag": true, "msg": ""}
 }
 
-func directSubKWSFree(types string, keys string, session *httpsession.Session) map[string]interface{} {
-	userId := qutil.ObjToString(session.Get("userId"))
+func directSubKWSFree(types string, keys string, sessionMap map[string]interface{}) map[string]interface{} {
+	userId := qutil.ObjToString(sessionMap["userId"])
 	var repleat = false
 	var kwsCount = 0
 	if len([]rune(keys)) > 20 {
@@ -153,7 +152,7 @@ func directSubKWSFree(types string, keys string, session *httpsession.Session) m
 	}
 	if flag == "y" {
 		//清楚缓存
-		positionId := fmt.Sprint(qutil.Int64All(session.Get("positionId")))
+		positionId := fmt.Sprint(qutil.Int64All(sessionMap["positionId"]))
 		jy.ClearBigVipUserPower(positionId)
 		config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
 			PositionId: positionId,
@@ -165,11 +164,11 @@ func directSubKWSFree(types string, keys string, session *httpsession.Session) m
 }
 
 // 免费用户删除关键词
-func DeleteKeyWordsFree(types, deletekey string, session *httpsession.Session) map[string]interface{} {
+func DeleteKeyWordsFree(types, deletekey string, sessionMap map[string]interface{}) map[string]interface{} {
 	//免费用户只有一个分类
 	var index = "0"
-	userId := qutil.ObjToString(session.Get("userId"))
-	dMap, err := util.JsonToMap(deletekey)
+	userId := qutil.ObjToString(sessionMap["userId"])
+	dMap, err := util.JsonToMap(deletekey) //{"0":"0"}
 	newMap, saveData := []interface{}{}, map[string]interface{}{}
 	if err == nil && len(dMap) > 0 {
 		data := config.Compatible.Select(userId, `{"`+types+`":1}`)
@@ -193,13 +192,13 @@ func DeleteKeyWordsFree(types, deletekey string, session *httpsession.Session) m
 		flag = config.Compatible.Update(userId, map[string]interface{}{
 			"$set": saveData,
 		})
-		SetLog(userId, types, 0, session)
+		SetLog(userId, types, 0, sessionMap)
 	}
 	return map[string]interface{}{"flag": flag, "msg": ""}
 }
 
 // 免费用户修改 保存关键词
-func AddKeyWordsFree(types, userId, classIndex, className, keywordsIndex, keywordName, keywordCount string, notKeyword, appendKeyword []string, matchWay int, session *httpsession.Session) map[string]interface{} {
+func AddKeyWordsFree(types, userId, classIndex, className, keywordsIndex, keywordName, keywordCount string, notKeyword, appendKeyword []string, matchWay int, sessionMap map[string]interface{}) map[string]interface{} {
 	flag := true
 	data := config.Compatible.Select(userId, `{"`+types+`":1}`)
 	saveData := map[string]interface{}{}
@@ -255,6 +254,11 @@ func AddKeyWordsFree(types, userId, classIndex, className, keywordsIndex, keywor
 			saveData[types+".a_key."+keywordsIndex+".notkey"] = notKeyword
 			saveData[types+".a_key."+keywordsIndex+".matchway"] = matchWay
 			saveData[types+".a_key."+keywordsIndex+".updatetime"] = time.Now().Unix()
+			if gconv.Bool(sessionMap["isHelpSub"]) {
+				if v := FreeIsInTsGuide(userId, 1); v != 0 {
+					saveData["i_ts_guide"] = v
+				}
+			}
 		}
 	}
 	if len(saveData) > 0 {
@@ -262,11 +266,10 @@ func AddKeyWordsFree(types, userId, classIndex, className, keywordsIndex, keywor
 		ok = config.Compatible.Update(userId, map[string]interface{}{
 			"$set": saveData,
 		})
-
 		if ok {
 			flag = true
 			//清楚缓存
-			positionId := fmt.Sprint(qutil.Int64All(session.Get("positionId")))
+			positionId := fmt.Sprint(qutil.Int64All(sessionMap["positionId"]))
 			jy.ClearBigVipUserPower(positionId)
 			config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
 				PositionId: positionId,
@@ -275,25 +278,27 @@ func AddKeyWordsFree(types, userId, classIndex, className, keywordsIndex, keywor
 			config.Middleground.PowerCheckCenter.DelCheckRedis("10000", qutil.Int64All(positionId))
 			//判断是新增
 			if (keywordCount == "" || keywordCount == "0") || (keywordCount == keywordsIndex || qutil.Int64All(keywordCount) == qutil.Int64All(keywordsIndex)+1) {
-				//设置关键词送积分
-				jy.Publish(db.Mgo_Log, config.Config.Nsq, config.Config.NsqTopic, "task", qutil.ObjToString(session.Get("mgoUserId")), jy.Jywx_node1, map[string]interface{}{
-					"code":       1015, //首次订阅
-					"types":      "subscribeKeyWords",
-					"num":        50,
-					"baseUserId": session.Get("base_user_id"),
-					"positionId": positionId,
-				})
+				if !gconv.Bool(sessionMap["isHelpSub"]) {
+					//设置关键词送积分
+					jy.Publish(db.Mgo_Log, config.Config.Nsq, config.Config.NsqTopic, "task", qutil.ObjToString(sessionMap["mgoUserId"]), jy.Jywx_node1, map[string]interface{}{
+						"code":       1015, //首次订阅
+						"types":      "subscribeKeyWords",
+						"num":        50,
+						"baseUserId": sessionMap["base_user_id"],
+						"positionId": positionId,
+					})
+				}
 			}
 		}
-		SetLog(userId, types, 0, session)
+		SetLog(userId, types, 0, sessionMap)
 	}
 	return map[string]interface{}{"flag": flag, "msg": ""}
 }
 
 // 保存/修改关键词
-func AddKeyWords(types, userId, classIndex, className, keywordsIndex, keywordName, keywordCount string, notKeyword, appendKeyword []string, matchWay int, session *httpsession.Session, matchmode string) map[string]interface{} {
+func AddKeyWords(types, userId, classIndex, className, keywordsIndex, keywordName, keywordCount string, notKeyword, appendKeyword []string, matchWay int, sessionMap map[string]interface{}, matchmode string) map[string]interface{} {
 	flag := true
-	positionType := qutil.Int64All(session.Get("positionType"))
+	positionType := qutil.Int64All(sessionMap["positionType"])
 	data := config.Compatible.Select(userId, `{"`+types+`.a_items":1}`)
 	saveData := map[string]interface{}{}
 	if data != nil && len(*data) > 0 {
@@ -356,32 +361,34 @@ func AddKeyWords(types, userId, classIndex, className, keywordsIndex, keywordNam
 		flag = config.Compatible.Update(userId, map[string]interface{}{
 			"$set": saveData,
 		})
-		SetLog(userId, types, positionType, session)
-		//判断是新增
-		if (keywordCount == "" || keywordCount == "0") || (keywordCount == keywordsIndex || qutil.Int64All(keywordCount) == qutil.Int64All(keywordsIndex)+1) {
-			//设置关键词送积分
-			err := jy.Publish(db.Mgo_Log, config.Config.Nsq, config.Config.NsqTopic, "task", qutil.ObjToString(session.Get("mgoUserId")), jy.Jywx_node1, map[string]interface{}{
-				"code":       1015, //首次订阅
-				"types":      "subscribeKeyWords",
-				"num":        50,
-				"baseUserId": session.Get("base_user_id"),
-				"positionId": session.Get("positionId"),
-			})
-			if err != nil {
-				log.Println("nsq队列写入失败-->", err, "task", session.Get("phone"))
-			}
-			//首次设置关键词 赠送一次抽奖机会
-			err = jy.Publish(db.Mgo_Log, config.Config.Nsq, config.Config.NsqTopic, "lottery_draw_task", qutil.ObjToString(session.Get("userId")), jy.Jywx_node1, map[string]interface{}{
-				"phone":      session.Get("phone"),
-				"userId":     session.Get("userId"),
-				"mgoUserId":  session.Get("mgoUserId"),
-				"positionId": session.Get("positionId"),
-				"activeId":   16,
-				"taskInfoId": consts.TaskIdSetKey,
-				"nickName":   session.Get("nickName"),
-			})
-			if err != nil {
-				log.Println("nsq队列写入失败-->", err, "lottery_draw_task", consts.TaskIdSetKey, session.Get("phone"))
+		SetLog(userId, types, positionType, sessionMap)
+		if !gconv.Bool(sessionMap["isHelpSub"]) {
+			//判断是新增
+			if (keywordCount == "" || keywordCount == "0") || (keywordCount == keywordsIndex || qutil.Int64All(keywordCount) == qutil.Int64All(keywordsIndex)+1) {
+				//设置关键词送积分
+				err := jy.Publish(db.Mgo_Log, config.Config.Nsq, config.Config.NsqTopic, "task", qutil.ObjToString(sessionMap["mgoUserId"]), jy.Jywx_node1, map[string]interface{}{
+					"code":       1015, //首次订阅
+					"types":      "subscribeKeyWords",
+					"num":        50,
+					"baseUserId": sessionMap["base_user_id"],
+					"positionId": sessionMap["positionId"],
+				})
+				if err != nil {
+					log.Println("nsq队列写入失败-->", err, "task", sessionMap["phone"])
+				}
+				//首次设置关键词 赠送一次抽奖机会
+				err = jy.Publish(db.Mgo_Log, config.Config.Nsq, config.Config.NsqTopic, "lottery_draw_task", qutil.ObjToString(sessionMap["userId"]), jy.Jywx_node1, map[string]interface{}{
+					"phone":      sessionMap["phone"],
+					"userId":     sessionMap["userId"],
+					"mgoUserId":  sessionMap["mgoUserId"],
+					"positionId": sessionMap["positionId"],
+					"activeId":   16,
+					"taskInfoId": consts.TaskIdSetKey,
+					"nickName":   sessionMap["nickName"],
+				})
+				if err != nil {
+					log.Println("nsq队列写入失败-->", err, "lottery_draw_task", consts.TaskIdSetKey, sessionMap["phone"])
+				}
 			}
 		}
 	}
@@ -389,7 +396,7 @@ func AddKeyWords(types, userId, classIndex, className, keywordsIndex, keywordNam
 }
 
 // 删除关键词可以批量
-func DeleteKeyWords(types, deletekey, userId string, session *httpsession.Session) map[string]interface{} {
+func DeleteKeyWords(types, deletekey, userId string, sessionMap map[string]interface{}) map[string]interface{} {
 	flag := true
 	dMap, err := util.JsonToMap(deletekey)
 	newMap, saveData := []interface{}{}, map[string]interface{}{}
@@ -430,13 +437,13 @@ func DeleteKeyWords(types, deletekey, userId string, session *httpsession.Sessio
 		flag = config.Compatible.Update(userId, map[string]interface{}{
 			"$set": saveData,
 		})
-		SetLog(userId, types, 0, session)
+		SetLog(userId, types, 0, sessionMap)
 	}
 	return map[string]interface{}{"flag": flag, "msg": ""}
 }
 
 // 删除分类【可以批量删除】
-func DeleteClass(types, classIndex, userId string, session *httpsession.Session) map[string]interface{} {
+func DeleteClass(types, classIndex, userId string, sessionMap map[string]interface{}) map[string]interface{} {
 	flag := true
 	items, saveData := []interface{}{}, map[string]interface{}{}
 	m := map[string]bool{}
@@ -459,13 +466,13 @@ func DeleteClass(types, classIndex, userId string, session *httpsession.Session)
 		flag = config.Compatible.Update(userId, map[string]interface{}{
 			"$set": saveData,
 		})
-		SetLog(userId, types, 0, session)
+		SetLog(userId, types, 0, sessionMap)
 	}
 	return map[string]interface{}{"flag": flag, "msg": ""}
 }
 
 // 创建分类名
-func AddClass(types, classIndex, className, userId string, session *httpsession.Session) map[string]interface{} {
+func AddClass(types, classIndex, className, userId string, sessionMap map[string]interface{}) map[string]interface{} {
 	flag := true
 	saveData := map[string]interface{}{}
 	data := config.Compatible.Select(userId, `{"`+types+`.a_items":1}`)
@@ -503,7 +510,7 @@ func AddClass(types, classIndex, className, userId string, session *httpsession.
 		flag = config.Compatible.Update(userId, map[string]interface{}{
 			"$set": saveData,
 		})
-		SetLog(userId, types, 0, session)
+		SetLog(userId, types, 0, sessionMap)
 	}
 	return map[string]interface{}{"flag": flag, "msg": ""}
 
@@ -559,16 +566,16 @@ type UpdateOther struct {
 	OtherBuyerclass int //其它采购单位
 	EntId           int
 	EntUserId       int
-	Session         *httpsession.Session
+	SessionMap      map[string]interface{}
 }
 
 func (this *UpdateOther) UpdateOther() map[string]interface{} {
-	power := jy.GetBigVipUserBaseMsg(this.Session, *config.Middleground)
+	power := jy.GetBigVipUserBaseMsgBySessVal(this.SessionMap, *config.Middleground)
 	if this.Type == "m" && power.Status < 0 {
 		return map[string]interface{}{"flag": false, "msg": "暂无权限"}
 	}
-	positionType := qutil.Int64All(this.Session.Get("positionType"))
-	positionId := fmt.Sprint(qutil.Int64All(this.Session.Get("positionId")))
+	positionType := qutil.Int64All(this.SessionMap["positionType"])
+	positionId := fmt.Sprint(qutil.Int64All(this.SessionMap["positionId"]))
 	types := "o_jy"
 	if this.Type == "m" {
 		types = "o_member_jy"
@@ -613,7 +620,7 @@ func (this *UpdateOther) UpdateOther() map[string]interface{} {
 			})
 			config.Middleground.PowerCheckCenter.DelCheckRedis("10000", qutil.Int64All(positionId))
 		}
-		SetLog(this.UserId, types, positionType, this.Session)
+		SetLog(this.UserId, types, positionType, this.SessionMap)
 	}
 
 	return map[string]interface{}{"flag": flag, "msg": ""}
@@ -670,7 +677,7 @@ func UpdateMatchmode(types, matchtype string) map[string]interface{} {
 		types + ".i_matchmode": strings.Split(matchtype, ","),
 	}
 }
-func directSubKWS(updateItems string, keys string, userId string, session *httpsession.Session, matchWay int) map[string]interface{} {
+func directSubKWS(updateItems string, keys string, userId string, sessionMap map[string]interface{}, matchWay int) map[string]interface{} {
 	flag := "n"
 	data := config.Compatible.Select(userId, fmt.Sprintf(`{"%s":1}`, updateItems))
 	var repleat = false
@@ -749,11 +756,11 @@ func directSubKWS(updateItems string, keys string, userId string, session *https
 }
 
 // 订阅设置记录
-func SetLog(userid, types string, power int64, session *httpsession.Session) {
+func SetLog(userid, types string, power int64, sessionMap map[string]interface{}) {
 	if power == 1 {
 		query := map[string]interface{}{
-			"i_userid": qutil.IntAll(session.Get("entUserId")),
-			"i_entid":  qutil.IntAll(session.Get("entId")),
+			"i_userid": qutil.IntAll(sessionMap["entUserId"]),
+			"i_entid":  qutil.IntAll(sessionMap["entId"]),
 			"i_type":   1,
 		}
 		res, _ := db.Mgo.FindOne("entniche_rule", query)

+ 57 - 49
src/jfw/modules/publicapply/src/subscribePush/entity/setting.go

@@ -2,12 +2,12 @@ package entity
 
 import (
 	qutil "app.yhyue.com/moapp/jybase/common"
-	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
 	"app.yhyue.com/moapp/jybase/redis"
 	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
 	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
 	"errors"
 	"fmt"
+	"github.com/gogf/gf/v2/util/gconv"
 	"jy/src/jfw/modules/publicapply/src/config"
 	"jy/src/jfw/modules/publicapply/src/db"
 	"jy/src/jfw/modules/publicapply/src/util"
@@ -19,15 +19,15 @@ import (
 
 // 订阅设置设置修改
 type SubscribeSet struct {
-	Area      map[string]interface{} //地区
-	Industry  []string               //行业
-	UserId    string                 //用户id
-	Type      string                 //类型
-	EntId     int
-	EntUserId int
-	Session   *httpsession.Session
-	District  map[string]interface{} //地区
-	Amount string
+	Area       map[string]interface{} //地区
+	Industry   []string               //行业
+	UserId     string                 //用户id
+	Type       string                 //类型
+	EntId      int
+	EntUserId  int
+	SessionMap map[string]interface{}
+	District   map[string]interface{} //地区
+	Amount     string
 }
 
 func (this *SubscribeSet) SetAreaAndIndustry() *FuncResult {
@@ -37,19 +37,20 @@ func (this *SubscribeSet) SetAreaAndIndustry() *FuncResult {
 	typ := this.Type
 	district := this.District
 	if typ == "m" {
-		return memberSet(area, district, industry, userId, this.Session)
+		return memberSet(area, district, industry, userId, this.SessionMap)
 	} else if typ == "v" {
-		return vipSet(area, district, industry, userId, this.Session)
+		return vipSet(area, district, industry, userId, this.SessionMap)
 	} else {
-		return freeSet(area, district, industry, userId, this.Session)
+		return freeSet(area, district, industry, userId, this.SessionMap)
 	}
 }
 
-func freeSet(area, district map[string]interface{}, industry []string, userId string, session *httpsession.Session) *FuncResult {
+func freeSet(area, district map[string]interface{}, industry []string, userId string, sessionMap map[string]interface{}) *FuncResult {
 	//isfirst:是否第一次设置地区;ppb:是否购买省级订阅包; areacount:省份订阅包购买的省份数量-1:全国 无限制调整
-	isfirst, ppb, areacount := IsCanSet(userId, area, session)
+	isfirst, ppb, areacount := IsCanSet(userId, area)
 	//购买省份订阅包 已调整地区次数
 	ppnum := 0
+	isHelpSub := gconv.Bool(sessionMap["isHelpSub"]) //帮助用户设置订阅信息不消耗次数
 	//免费用户购买省份订阅包 按月算
 	ym := fmt.Sprint(time.Now().Year()) + "-" + fmt.Sprint(time.Now().Month())
 	if ppb {
@@ -70,56 +71,64 @@ func freeSet(area, district map[string]interface{}, industry []string, userId st
 			return &FuncResult{false, errors.New("超出地区可设置范围"), nil}
 		}
 		//地区调整次数判断
-		if areacount+jy.BaseAreaNum <= ppnum { //+fpnum
-			return &FuncResult{false, errors.New(fmt.Sprintf("订阅地区调整次数(%d)已用完", areacount+jy.BaseAreaNum)), nil}
+		if areacount+jy.BaseAreaNum <= ppnum+fpnum {
+			return &FuncResult{false, fmt.Errorf("订阅地区调整次数已用完"), nil}
 		}
 	}
 	//清楚缓存
-	positionId := fmt.Sprint(qutil.Int64All(session.Get("positionId")))
+	positionId := fmt.Sprint(qutil.Int64All(sessionMap["positionId"]))
 	jy.ClearBigVipUserPower(positionId)
 	config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
 		PositionId: positionId,
 		AppId:      "10000",
 	})
 	config.Middleground.PowerCheckCenter.DelCheckRedis("10000", qutil.Int64All(positionId))
-	if !FreeSubChange(userId, &area, &district, industry, ppb, isfirst) {
+
+	if !FreeSubChange(userId, &area, &district, industry, ppb, isfirst, sessionMap) {
 		return &FuncResult{false, errors.New("保存修改出错"), nil}
 	} else if issetredis { //更新调整次数 非全国(第一次 不消耗次数)
 		//优先使用省份订阅包次数
-		// log.Println(areacount, "---", ppnum)
-		// log.Println(jy.BaseAreaNum, "---", fpnum)
-		if ppb {
-			if areacount+jy.BaseAreaNum > ppnum {
-				redis.Put(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, userId, ym), ppnum+1, 31*24*60*60)
+		if !isHelpSub {
+			if ppb {
+				if areacount+jy.BaseAreaNum > ppnum {
+					redis.Put(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, userId, ym), ppnum+1, 31*24*60*60)
+				} else {
+					log.Println(fmt.Sprintf("免费用户购买省份订阅包设置地区 扣除次数异常  userId:%s", userId))
+				}
+			} else if jy.BaseAreaNum > fpnum {
+				redis.Put(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, userId, year), fpnum+1, 365*24*60*60)
 			} else {
-				log.Println(fmt.Sprintf("免费用户购买省份订阅包设置地区 扣除次数异常  userId:%s", userId))
+				log.Println(fmt.Sprintf("免费用户设置地区 扣除次数异常  userId:%s", userId))
 			}
-		} else if jy.BaseAreaNum > fpnum {
-			redis.Put(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, userId, year), fpnum+1, 365*24*60*60)
-		} else {
-			log.Println(fmt.Sprintf("免费用户设置地区 扣除次数异常  userId:%s", userId))
 		}
 	}
-	SetLog(userId, "o_jy", 0, session)
+	SetLog(userId, "o_jy", 0, sessionMap)
 	return &FuncResult{true, nil, map[string]interface{}{
 		"doSuccess": true,
 	}}
 }
 
 // 免费用户地区调整
-func FreeSubChange(userId string, area, district *map[string]interface{}, industry []string, ppb, isfirst bool) bool {
-	setMap := map[string]interface{}{"$set": map[string]interface{}{
+func FreeSubChange(userId string, area, district *map[string]interface{}, industry []string, ppb, isfirst bool, sessionMap map[string]interface{}) bool {
+	setMap := map[string]interface{}{
 		"o_jy.o_area":     area,     //设置地区
 		"o_jy.o_district": district, //设置地区
 		"o_jy.i_newfree":  1,        //老免费用户=>新订阅设置页面 20211122
-	}}
+	}
 	if ppb {
-		setMap = map[string]interface{}{"$set": map[string]interface{}{
+		setMap = map[string]interface{}{
 			"o_jy.o_area_p":  area, //设置地区
 			"o_jy.i_newfree": 1,    //老免费用户=>新订阅设置页面 20211122
-		}}
+		}
+	}
+	if gconv.Bool(sessionMap["isHelpSub"]) && area != nil && len(*area) > 0 {
+		if v := FreeIsInTsGuide(userId, 2); v != 0 {
+			setMap["i_ts_guide"] = v
+		}
 	}
-	updateOk := config.Compatible.Update(userId, setMap)
+	updateOk := config.Compatible.Update(userId, map[string]interface{}{
+		"$set": setMap,
+	})
 	if !updateOk {
 		return false
 	}
@@ -127,7 +136,7 @@ func FreeSubChange(userId string, area, district *map[string]interface{}, indust
 }
 
 // 是否可进行地区调整
-func IsCanSet(userId string, areamap map[string]interface{}, session *httpsession.Session) (bool, bool, int) {
+func IsCanSet(userId string, areamap map[string]interface{}) (bool, bool, int) {
 	areacount := 0
 	myarea := []string{}
 	setarea := []string{}
@@ -177,11 +186,11 @@ func areaSort(area []string) string {
 	return strings.Join(area, ",")
 }
 
-func vipSet(area, district map[string]interface{}, industry []string, userId string, session *httpsession.Session) *FuncResult {
+func vipSet(area, district map[string]interface{}, industry []string, userId string, sessionMap map[string]interface{}) *FuncResult {
 	if len(industry) == 1 && industry[0] == "" {
 		industry = []string{}
 	}
-	positionType := qutil.Int64All(session.Get("positionType"))
+	positionType := qutil.Int64All(sessionMap["positionType"])
 	rData, oldBuyset, isVip := GetVipDetail(userId)
 	if !isVip {
 		return &FuncResult{false, errors.New("请求异常,非vip状态"), nil}
@@ -195,19 +204,19 @@ func vipSet(area, district map[string]interface{}, industry []string, userId str
 		log.Printf("%s 订阅内容超出套餐 %+v area:%v industry:%v", userId, oldBuyset, area, industry)
 		return &FuncResult{false, errors.New("订阅内容超出套餐"), nil}
 	}
-	if !VipSubChange(userId, qutil.ObjToMap((*rData)["o_vipjy"]), &area, &district, industry, session) {
+	if !VipSubChange(userId, qutil.ObjToMap((*rData)["o_vipjy"]), &area, &district, industry) {
 		return &FuncResult{false, errors.New("保存修改出错"), nil}
 	}
 
-	SetLog(userId, "o_vipjy", positionType, session)
+	SetLog(userId, "o_vipjy", positionType, sessionMap)
 	return &FuncResult{true, nil, map[string]interface{}{
 		"doSuccess": true,
 	}}
 }
 
 // 大会员订阅设置
-func memberSet(area, district map[string]interface{}, industry []string, userId string, session *httpsession.Session) *FuncResult {
-	if data := jy.GetBigVipUserBaseMsg(session, *config.Middleground); data.Status <= 0 {
+func memberSet(area, district map[string]interface{}, industry []string, userId string, sessionMap map[string]interface{}) *FuncResult {
+	if data := jy.GetBigVipUserBaseMsgBySessVal(sessionMap, *config.Middleground); data.Status <= 0 {
 		return &FuncResult{false, errors.New("请求异常,非大会员状态"), nil}
 	}
 	if len(industry) == 1 && industry[0] == "" {
@@ -218,11 +227,11 @@ func memberSet(area, district map[string]interface{}, industry []string, userId
 		log.Printf("%s 订阅内容超出套餐 %+v area:%v industry:%v", userId, memberInfo, area, industry)
 		return &FuncResult{false, errors.New("订阅内容超出套餐"), nil}
 	}
-	positionType := qutil.Int64All(session.Get("positionType"))
-	if !MemberSubChange(userId, &area, &district, industry, session) {
+	positionType := qutil.Int64All(sessionMap["positionType"])
+	if !MemberSubChange(userId, &area, &district, industry) {
 		return &FuncResult{false, errors.New("保存修改出错"), nil}
 	}
-	SetLog(userId, "o_member_jy", positionType, session)
+	SetLog(userId, "o_member_jy", positionType, sessionMap)
 	return &FuncResult{true, nil, map[string]interface{}{
 		"doSuccess": true,
 	}}
@@ -543,7 +552,7 @@ func needUpgrade(newBuySet, oldBuySet *SubvipBuySet) bool {
 }
 
 // 超级订阅 订阅修改
-func VipSubChange(userId string, oldVip, areaNew, district *map[string]interface{}, industryNew []string, session *httpsession.Session) bool {
+func VipSubChange(userId string, oldVip, areaNew, district *map[string]interface{}, industryNew []string) bool {
 	updateOk := false
 	updateOk = config.Compatible.Update(userId,
 		map[string]interface{}{"$set": map[string]interface{}{
@@ -572,7 +581,7 @@ func VipSubChange(userId string, oldVip, areaNew, district *map[string]interface
 }
 
 // 超级订阅 订阅修改
-func MemberSubChange(userId string, areaNew, district *map[string]interface{}, industryNew []string, session *httpsession.Session) bool {
+func MemberSubChange(userId string, areaNew, district *map[string]interface{}, industryNew []string) bool {
 	if updateOk := config.Compatible.Update(userId,
 		map[string]interface{}{"$set": map[string]interface{}{
 			"o_member_jy.o_area":       areaNew,     //设置地区
@@ -581,6 +590,5 @@ func MemberSubChange(userId string, areaNew, district *map[string]interface{}, i
 		}}); !updateOk {
 		return false
 	}
-
 	return true
 }

+ 32 - 11
src/jfw/modules/publicapply/src/subscribePush/entity/vrew.go

@@ -12,7 +12,6 @@ import (
 
 	qutil "app.yhyue.com/moapp/jybase/common"
 	elastic "app.yhyue.com/moapp/jybase/es"
-	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
 	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
 )
 
@@ -45,7 +44,7 @@ const (
  *@param notkey 排除词
  *@param matchway 0:精准 1:模糊
  */
-func KeysetViewDatasCount(userId, vType, key, notkey string, matchway int, session *httpsession.Session) int64 {
+func KeysetViewDatasCount(userId, vType, key, notkey string, matchway int, sessionMap map[string]interface{}) int64 {
 	key = strings.TrimSpace(key)
 	notkey = strings.TrimSpace(notkey)
 	if key == "" {
@@ -55,7 +54,7 @@ func KeysetViewDatasCount(userId, vType, key, notkey string, matchway int, sessi
 	if vType == "" {
 		sql = GetSqlObjFromFreeId(userId, "", -1)
 	} else {
-		sql = GetSqlObjFromId(userId, vType, "", -1, session)
+		sql = GetSqlObjFromId(userId, vType, "", -1, sessionMap)
 	}
 
 	viewKeyWords := []ViewKeyWord{}
@@ -75,7 +74,13 @@ func KeysetViewDatasCount(userId, vType, key, notkey string, matchway int, sessi
 		}
 	}
 	sql.Keyword = viewKeyWords
-	qstr := GetVIPViewSql(userId, sql)
+	var qstr string
+	if gconv.Bool(sessionMap["isHelpSub"]) {
+		qstr = GetVIPViewSql(userId, sql, -15)
+	} else {
+		qstr = GetVIPViewSql(userId, sql)
+	}
+	fmt.Println(qstr)
 	return elastic.Count(INDEX, TYPE, qstr)
 }
 
@@ -84,8 +89,8 @@ func KeysetViewDatasCount(userId, vType, key, notkey string, matchway int, sessi
  *@param item 分类名称
  *@param index 关键词在分类下的索引位置
  */
-func SubViewDatasCount(userId, vType, item string, index int, session *httpsession.Session) int64 {
-	sql := GetSqlObjFromId(userId, vType, item, index, session)
+func SubViewDatasCount(userId, vType, item string, index int, sessionMap map[string]interface{}) int64 {
+	sql := GetSqlObjFromId(userId, vType, item, index, sessionMap)
 	if item != "" && index >= 0 && (sql.Keyword == nil || len(sql.Keyword) == 0) {
 		log.Println("推送结果预览总数参数异常,没有找到改组订阅词", item, index)
 		return 0
@@ -95,16 +100,24 @@ func SubViewDatasCount(userId, vType, item string, index int, session *httpsessi
 }
 
 // 获取vip订阅预览的查询语句
-func GetVIPViewSql(userId string, scd *ViewCondition) string {
+func GetVIPViewSql(userId string, scd *ViewCondition, dayLimit ...int) string {
 	query := `{"query":{"bool":{"must":[%s],"should":[%s],"minimum_should_match": %d}}}`
 	query_bool_should := `{"bool":{"should":[%s],"minimum_should_match": 1}}`
 	multi_match := `{"multi_match": {"query": %s,"type": "phrase", "fields": [%s]}}`
 	query_bool_must_and := `{"bool":{"must":[%s]%s}}`
+	var (
+		month int = -3
+		day   int
+	)
+	if dayLimit != nil && len(dayLimit) > 0 {
+		month = 0
+		day = dayLimit[0]
+	}
 
 	bools := []string{}
 	musts := []string{}
 	//发布时间最新三个月
-	musts = append(musts, fmt.Sprintf(`{"range":{"publishtime":{"gte":%d}}}`, time.Now().AddDate(0, -3, 0).Unix()))
+	musts = append(musts, fmt.Sprintf(`{"range":{"publishtime":{"gte":%d}}}`, time.Now().AddDate(0, month, day).Unix()))
 	//省份
 	areaCity := []string{}
 	if len(scd.Area) > 0 {
@@ -222,16 +235,20 @@ func GetVIPViewSql(userId string, scd *ViewCondition) string {
 	return qstr
 }
 
-func GetSqlObjFromId(_id, vType, item string, index int, session *httpsession.Session) *ViewCondition {
-	query := config.Compatible.Select(_id, `{"o_vipjy":1,"o_member_jy":1}`)
+func GetSqlObjFromId(_id, vType, item string, index int, sessionMap map[string]interface{}) *ViewCondition {
+	query := config.Compatible.Select(_id, `{"o_vipjy":1,"o_member_jy":1,"o_jy":1}`)
 	if query == nil || len(*query) == 0 {
 		return nil
 	}
 	o_vipjy := map[string]interface{}{}
+	var i_ppstatus int
 	if vType == jy.MemberFlag {
 		o_vipjy, _ = (*query)["o_member_jy"].(map[string]interface{})
-	} else {
+	} else if vType == jy.SubVipFlag {
 		o_vipjy, _ = (*query)["o_vipjy"].(map[string]interface{})
+	} else {
+		o_vipjy, _ = (*query)["o_jy"].(map[string]interface{})
+		i_ppstatus = gconv.Int(o_vipjy["i_ppstatus"])
 	}
 	a_items, _ := o_vipjy["a_items"].([]interface{})
 	a_buyerclass, _ := o_vipjy["a_buyerclass"].([]interface{})
@@ -239,7 +256,11 @@ func GetSqlObjFromId(_id, vType, item string, index int, session *httpsession.Se
 		a_buyerclass = append(a_buyerclass, "其它")
 	}
 	a_infotype, _ := o_vipjy["a_infotype"].([]interface{})
+
 	o_area, _ := o_vipjy["o_area"].(map[string]interface{})
+	if i_ppstatus > 0 {
+		o_area, _ = o_vipjy["o_area_p"].(map[string]interface{})
+	}
 	return &ViewCondition{
 		Keyword:    getKeyWordArrFromDbResult(a_items, item, index),
 		Buyerclass: qutil.ObjArrToStringArr(a_buyerclass),

+ 49 - 22
src/jfw/modules/publicapply/src/subscribePush/service/pushList.go

@@ -3,18 +3,22 @@ package service
 import (
 	"encoding/json"
 	"fmt"
+	"github.com/gogf/gf/v2/frame/g"
+	"github.com/gogf/gf/v2/util/gconv"
 	"jy/src/jfw/modules/publicapply/src/config"
 	"jy/src/jfw/modules/publicapply/src/db"
 	"jy/src/jfw/modules/publicapply/src/me"
 	"jy/src/jfw/modules/publicapply/src/subscribePush/entity"
 	"log"
+	"strings"
 	"time"
 
 	. "app.yhyue.com/moapp/jybase/api"
-	util "app.yhyue.com/moapp/jybase/common"
+	qutil "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/encrypt"
 	"app.yhyue.com/moapp/jybase/redis"
 	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	"jy/src/jfw/modules/publicapply/src/util"
 
 	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
 )
@@ -67,7 +71,7 @@ func (sp *SubscribePush) VipSwitch() {
 			return nil, fmt.Errorf("未知请求")
 		}
 		return map[string]interface{}{
-			"vt":   util.ObjToString(sp.GetSession(jy.SwitchService.SessionKey)),
+			"vt":   qutil.ObjToString(sp.GetSession(jy.SwitchService.SessionKey)),
 			"flag": switchOk,
 		}, nil
 	}()
@@ -79,7 +83,7 @@ func (sp *SubscribePush) VipSwitch() {
 
 // HasPushHistory 大会员、超级订阅,商机管理推送历史 (原wx推送更改)
 func (sp *SubscribePush) HasPushHistory() {
-	userId := util.ObjToString(sp.GetSession("userId"))
+	userId := qutil.ObjToString(sp.GetSession("userId"))
 	if userId == "" {
 		return
 	}
@@ -89,7 +93,7 @@ func (sp *SubscribePush) HasPushHistory() {
 		vipType = jy.SwitchService.GetEntniche(sp.Session(), *config.Middleground)
 	}
 	if vipType == jy.SwitchService.Entniche {
-		userId = fmt.Sprint(util.IntAll(sp.GetSession("entUserId")))
+		userId = fmt.Sprint(qutil.IntAll(sp.GetSession("entUserId")))
 	}
 	//entId := util.IntAll(sp.GetSession("entId"))
 	go entity.HistoryPush.UpdateUserPushUnread(userId, vipType)
@@ -100,7 +104,7 @@ func (sp *SubscribePush) HasPushHistory() {
 	todayNum := time.Unix(time.Now().Unix(), 1).Format("20060102")
 	if user != nil {
 		//超级订阅
-		if util.IntAll((*user)["i_vip_status"]) == 1 || util.IntAll((*user)["i_vip_status"]) == 2 {
+		if qutil.IntAll((*user)["i_vip_status"]) == 1 || qutil.IntAll((*user)["i_vip_status"]) == 2 {
 			var threeRemind = int64(3 * 24 * 60 * 60)
 			var twoRemind = int64(2 * 24 * 60 * 60)
 			var oneRemind = int64(1 * 24 * 60 * 60)
@@ -109,14 +113,14 @@ func (sp *SubscribePush) HasPushHistory() {
 			}
 			isVipFlag = true
 			isPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+todayNum+"_"+userId) >= 2000
-			isOnTail = util.IntAll((*user)["i_vip_status"])
+			isOnTail = qutil.IntAll((*user)["i_vip_status"])
 			_endtime := (*user)["l_vip_endtime"]
 			//是否到期
-			if util.Int64All(_endtime)-time.Now().Unix() < threeRemind && util.Int64All(_endtime)-time.Now().Unix() >= twoRemind {
+			if qutil.Int64All(_endtime)-time.Now().Unix() < threeRemind && qutil.Int64All(_endtime)-time.Now().Unix() >= twoRemind {
 				isExpire = 3 //即将到期
-			} else if util.Int64All(_endtime)-time.Now().Unix() < twoRemind && util.Int64All(_endtime)-time.Now().Unix() >= oneRemind {
+			} else if qutil.Int64All(_endtime)-time.Now().Unix() < twoRemind && qutil.Int64All(_endtime)-time.Now().Unix() >= oneRemind {
 				isExpire = 2 //即将到期
-			} else if util.Int64All(_endtime)-time.Now().Unix() < oneRemind && util.Int64All(_endtime)-time.Now().Unix() >= 0 {
+			} else if qutil.Int64All(_endtime)-time.Now().Unix() < oneRemind && qutil.Int64All(_endtime)-time.Now().Unix() >= 0 {
 				isExpire = 1 //即将到期
 			}
 			//判断首次用户是否推送的带有”其他“
@@ -130,7 +134,7 @@ func (sp *SubscribePush) HasPushHistory() {
 			if (*user)["i_vip_status"] == nil {
 				isExpire = 0
 			} else {
-				isOnTail = util.IntAll((*user)["i_vip_status"])
+				isOnTail = qutil.IntAll((*user)["i_vip_status"])
 			}
 			isPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+todayNum+"_"+userId) >= 150
 		}
@@ -213,9 +217,9 @@ func (sp *SubscribePush) HistoryPaging() {
 		vipType = jy.SwitchService.GetEntniche(sp.Session(), *config.Middleground)
 	}
 	if vipType == jy.SwitchService.Entniche {
-		userId = fmt.Sprint(util.IntAll(sp.GetSession("entUserId")))
+		userId = fmt.Sprint(qutil.IntAll(sp.GetSession("entUserId")))
 	}
-	entId := util.IntAll(sp.GetSession("entId"))
+	entId := qutil.IntAll(sp.GetSession("entId"))
 	pageNum, _ := sp.GetInteger("pageNum")
 	PageSize, _ := sp.GetInteger("pageSize")
 	if pageNum == 1 {
@@ -283,7 +287,7 @@ func (sp *SubscribePush) HistoryPaging() {
 
 // SetRead 推送记录设置已读
 func (sp *SubscribePush) SetRead() error {
-	defer util.Catch()
+	defer qutil.Catch()
 	vsid, _ := sp.GetInteger("vsid")
 	if vsid <= 0 {
 		return nil
@@ -292,7 +296,7 @@ func (sp *SubscribePush) SetRead() error {
 	if vipType == "" { //默认取已切换的企业
 		vipType = jy.SwitchService.GetEntniche(sp.Session(), *config.Middleground)
 	}
-	if userId := util.ObjToString(sp.GetSession("userId")); userId != "" {
+	if userId := qutil.ObjToString(sp.GetSession("userId")); userId != "" {
 		if vipType == jy.SwitchService.Member {
 			jy.NewSubscribePush(vipType).Visit(db.MysqlMemberPush, userId, vsid)
 		} else if vipType == jy.SwitchService.Entniche {
@@ -314,19 +318,42 @@ func (sp *SubscribePush) PushSetting() {
 
 }
 
-// GetPushCount 订阅设置订阅词近三个月推送数量
+// GetPushCount 订阅设置订阅词近三个月推送数量(帮助用户设置订阅次为15天)
 func (sp *SubscribePush) GetPushCount() error {
-	defer util.Catch()
-	userId, _ := sp.GetSession("userId").(string)
+	defer qutil.Catch()
+	var (
+		sessionMap = sp.Session().GetMultiple()
+		userId     = gconv.String(sessionMap["userId"])
+		ent_id     = gconv.Int(sessionMap["entId"])
+		isHelp     = false
+	)
+	//校验是否剑鱼员工
+	if ent_id == g.Cfg().MustGet(sp.Request.Context(), "powerEntId", 25917).Int() && strings.Index(sp.Refer(), "/free/help/set_subscribe") > -1 {
+		if helpUserId := sp.Cookie("usrDewkYanV3"); helpUserId != "" {
+			if identityInfo := util.HelpSubscribeDecode(helpUserId); identityInfo.UserId != "" {
+				userId = identityInfo.UserId
+				ent_id = identityInfo.EntId
+				sessionMap = map[string]interface{}{
+					"userId":       userId,
+					"positionId":   helpUserId,
+					"positionType": identityInfo.PositionType,
+					"mgoUserId":    identityInfo.MgoUserId,
+					"base_user_id": identityInfo.BaseUserId,
+					"isHelpSub":    true,
+				}
+				isHelp = true
+			}
+		}
+	}
+
 	if userId != "" {
 		vipType := sp.GetString("vt")
-		if vipType == "" { //默认取已切换的企业
+		if vipType == "" && !isHelp { //默认取已切换的企业
 			vipType = jy.SwitchService.GetEntniche(sp.Session(), *config.Middleground)
-
 		}
 		matchway, _ := sp.GetInteger("matchway")
 		sp.ServeJson(map[string]interface{}{
-			"count": entity.KeysetViewDatasCount(userId, vipType, sp.GetString("key"), sp.GetString("notkey"), matchway, sp.Session()),
+			"count": entity.KeysetViewDatasCount(userId, vipType, sp.GetString("key"), sp.GetString("notkey"), matchway, sessionMap),
 		})
 	}
 	return nil
@@ -334,7 +361,7 @@ func (sp *SubscribePush) GetPushCount() error {
 
 // getPushAllCount 全部关键词-最近三个月推送结果预览总数
 func (sp *SubscribePush) GetPushAllCount() error {
-	defer util.Catch()
+	defer qutil.Catch()
 	userId, _ := sp.GetSession("userId").(string)
 	if userId != "" {
 		index, _ := sp.GetInteger("index")
@@ -343,7 +370,7 @@ func (sp *SubscribePush) GetPushAllCount() error {
 			vipType = jy.SwitchService.GetEntniche(sp.Session(), *config.Middleground)
 		}
 		sp.ServeJson(map[string]interface{}{
-			"count": entity.SubViewDatasCount(userId, vipType, sp.GetString("item"), index, sp.Session()),
+			"count": entity.SubViewDatasCount(userId, vipType, sp.GetString("item"), index, sp.Session().GetMultiple()),
 		})
 	}
 	return nil

+ 71 - 22
src/jfw/modules/publicapply/src/subscribePush/service/subscribe.go

@@ -1,14 +1,16 @@
 package service
 
 import (
+	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
+	"github.com/gogf/gf/v2/frame/g"
 	"jy/src/jfw/modules/publicapply/src/config"
 	"jy/src/jfw/modules/publicapply/src/subscribePush/entity"
+	"jy/src/jfw/modules/publicapply/src/util"
 	"log"
 	"regexp"
 	"strings"
 
 	qutil "app.yhyue.com/moapp/jybase/common"
-	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
 	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
 	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
 )
@@ -22,22 +24,46 @@ type Subscribe struct {
 
 // 大会员、超级订阅订阅修改
 func (s *Subscribe) Update() {
-	userId := qutil.ObjToString(s.GetSession("userId"))
-	ent_id := qutil.IntAll(s.GetSession("entId"))
-	entUserId := qutil.IntAll(s.GetSession("entUserId"))
-	vSwitch := s.GetString("vSwitch")
-	if vSwitch == "" {
-		vSwitch = jy.SwitchService.Get(s.Session(), *config.Middleground) //v:vip m:member
+	var (
+		sessionMap = s.Session().GetMultiple()
+		userId     = qutil.ObjToString(sessionMap["userId"])
+		ent_id     = qutil.IntAll(sessionMap["entId"])
+		entUserId  = qutil.IntAll(sessionMap["entUserId"])
+		isHelp     = false
+		vSwitch    = s.GetString("vSwitch")
+	)
+	//校验是否剑鱼员工
+	if ent_id == g.Cfg().MustGet(s.Request.Context(), "powerEntId", 25917).Int() && strings.Index(s.Refer(), "/free/help/set_subscribe") > -1 {
+		if helpUserId := s.Cookie("usrDewkYanV3"); helpUserId != "" {
+			if identityInfo := util.HelpSubscribeDecode(helpUserId); identityInfo.UserId != "" {
+				userId = identityInfo.UserId
+				ent_id = identityInfo.EntId
+				entUserId = identityInfo.EntUserId
+				sessionMap = map[string]interface{}{
+					"userId":       userId,
+					"positionId":   helpUserId,
+					"positionType": identityInfo.PositionType,
+					"mgoUserId":    identityInfo.MgoUserId,
+					"base_user_id": identityInfo.BaseUserId,
+					"isHelpSub":    true,
+				}
+				isHelp = true
+			}
+		}
 	}
 	sub := &entity.SubscribeSet{
-		Area:      *qutil.ObjToMap(s.GetString("area")),
-		Industry:  strings.Split(s.GetString("industry"), ","),
-		UserId:    userId,
-		Type:      vSwitch,
-		EntId:     ent_id,
-		EntUserId: entUserId,
-		Session:   s.Session(),
-		District:  *qutil.ObjToMap(s.GetString("district")),
+		Area:       *qutil.ObjToMap(s.GetString("area")),
+		Industry:   strings.Split(s.GetString("industry"), ","),
+		UserId:     userId,
+		Type:       vSwitch,
+		EntId:      ent_id,
+		EntUserId:  entUserId,
+		SessionMap: sessionMap,
+		District:   *qutil.ObjToMap(s.GetString("district")),
+	}
+
+	if vSwitch == "" && !isHelp {
+		vSwitch = jy.SwitchService.Get(s.Session(), *config.Middleground) //v:vip m:member
 	}
 	r := sub.SetAreaAndIndustry()
 	if r.Err != nil {
@@ -53,11 +79,34 @@ var (
 // 关键词、关键词匹配方式、信息类型、项目匹配
 func (s *Subscribe) SetUserInfo() {
 	r := map[string]interface{}{}
-	userId := qutil.ObjToString(s.GetSession("userId"))
-	entId := qutil.IntAll(s.GetSession("entId"))
-	entUserId := qutil.IntAll(s.GetSession("entUserId"))
-	vSwitch := s.GetString("vSwitch")
-	if vSwitch == "" {
+	var (
+		userId     = qutil.ObjToString(s.GetSession("userId"))
+		entId      = qutil.IntAll(s.GetSession("entId"))
+		entUserId  = qutil.IntAll(s.GetSession("entUserId"))
+		vSwitch    = s.GetString("vSwitch")
+		isHelp     = false
+		sessionMap = s.Session().GetMultiple()
+	)
+	//校验是否剑鱼员工
+	if entId == g.Cfg().MustGet(s.Request.Context(), "powerEntId", 25917).Int() && strings.Index(s.Refer(), "/free/help/set_subscribe") > -1 {
+		if helpUserId := s.Cookie("usrDewkYanV3"); helpUserId != "" {
+			if identityInfo := util.HelpSubscribeDecode(helpUserId); identityInfo.UserId != "" {
+				userId = identityInfo.UserId
+				entId = identityInfo.EntId
+				entUserId = identityInfo.EntUserId
+				sessionMap = map[string]interface{}{
+					"userId":       userId,
+					"positionId":   helpUserId,
+					"positionType": identityInfo.PositionType,
+					"mgoUserId":    identityInfo.MgoUserId,
+					"base_user_id": identityInfo.BaseUserId,
+					"isHelpSub":    true,
+				}
+				isHelp = true
+			}
+		}
+	}
+	if vSwitch == "" && !isHelp {
 		vSwitch = jy.SwitchService.Get(s.Session(), *config.Middleground) //v:vip m:member "":free
 	}
 	if pageType := s.GetString("pageType"); pageType == "keyWords" {
@@ -86,7 +135,7 @@ func (s *Subscribe) SetUserInfo() {
 			DeleteKey:     s.GetString("delete_key"),
 			EntUserId:     entUserId,
 			EntId:         entId,
-			Session:       s.Session(),
+			SessionMap:    sessionMap,
 		}
 		r = sub.UpdateKeyWords()
 	} else {
@@ -103,7 +152,7 @@ func (s *Subscribe) SetUserInfo() {
 			OtherBuyerclass: other,
 			EntUserId:       entUserId,
 			EntId:           entId,
-			Session:         s.Session(),
+			SessionMap:      sessionMap,
 		}
 		r = uo.UpdateOther()
 	}

+ 32 - 0
src/jfw/modules/publicapply/src/util/helpUserSubscribe.go

@@ -0,0 +1,32 @@
+package util
+
+import (
+	"app.yhyue.com/moapp/jybase/encrypt"
+	"encoding/json"
+)
+
+type HelpSubscribe struct {
+	UserId       string `json:"userId"`
+	PersonId     int64  `json:"personId"`
+	EntId        int    `json:"entId"`
+	EntUserId    int    `json:"entUserId"`
+	PositionType int    `json:"positionType"`
+	MgoUserId    string `json:"mgoUserId"`
+	BaseUserId   int    `json:"baseUserId"`
+}
+
+// 加密
+func HelpSubscribeEncode(i *HelpSubscribe) string {
+	b, _ := json.Marshal(i)
+	return encrypt.SE.Encode2Hex(string(b))
+}
+
+// 解密
+func HelpSubscribeDecode(v string) *HelpSubscribe {
+	i := &HelpSubscribe{}
+	err := json.Unmarshal([]byte(encrypt.SE.Decode4Hex(v)), &i)
+	if err != nil {
+		return nil
+	}
+	return i
+}

+ 1 - 1
src/jfw/modules/subscribepay/src/entity/bidCreditReport/bidCreditReport.go

@@ -602,7 +602,7 @@ func (b *bidCreditReport) GetDataInfo(ctx gctx.Ctx, data map[string]interface{},
 				}
 				infoUrl := ""
 				if infos := vv.GetVar("list").Maps(); len(infos) > 0 {
-					infoUrl = config.Config.WebDomain + "/nologin/content/" + encrypt.CommonEncodeArticle("content", gmap.NewStrAnyMapFrom(infos[len(infos)-1]).GetVar("infoid").String()) + ".html?source=bidCreditReport"
+					infoUrl = config.Config.WebDomain + "/nologin/content/" + encrypt.EncodeArticleId2ByCheck(gmap.NewStrAnyMapFrom(infos[len(infos)-1]).GetVar("infoid").String()) + ".html?source=bidCreditReport"
 				}
 				records = append(records, []string{vv.GetVar("id").String(), projectName, buyer, gtime.New(vv.GetVar("lasttime").Int64()).Layout(time.DateTime), "-", sortprice, "-", area, city, "-", "-", infoUrl})
 			}