Browse Source

Merge branch 'dev4.6.3' of http://127.0.0.1:9182/qmx/jy into dev4.6.3

tsz 3 years ago
parent
commit
8ffa1cd359

+ 15 - 0
src/jfw/front/entsearch.go

@@ -18,6 +18,7 @@ type Entsearch struct {
 	pcSearchZbqyAjax     xweb.Mapper `xweb:"/jylab/pcSearchZbqyAjax"`
 	recList              xweb.Mapper `xweb:"/jylab/bidsearchforent/recList"`
 	entSearchIndex       xweb.Mapper `xweb:"/jylab/entSearch/index.html"`
+	pushSearchIndex       xweb.Mapper `xweb:"/jylab/purSearch/index.html"`
 }
 
 func init() {
@@ -35,6 +36,20 @@ func (e *Entsearch) EntSearchIndex() error {
 	e.T["logid"] = config.Seoconfig["jyzbqyss"].(string)
 	return e.Render("/pc/entsearchindex.html", &e.T)
 }
+func (e *Entsearch) PushSearchIndex() error {
+	defer util.Catch()
+	var shareid = e.GetString("id")
+	if len(shareid) == 0 {
+		shareid = "10"
+	}
+	e.T["shareid"] = se.EncodeString(shareid)
+	e.T["searchvalue"] = e.GetString("searchvalue")
+	e.T["logid"] = config.Seoconfig["jyzbqyss"].(string)
+	e.T["sortArray"] = sortArray
+	e.T["industrylist"] = industrylist
+	return e.Render("/pc/pursearchindex.html", &e.T)
+}
+
 
 func (e *Entsearch) Bidsearchforentindex() error {
 	defer util.Catch()

+ 1 - 1
src/jfw/modules/app/src/config.json

@@ -35,7 +35,7 @@
 		"remark": "您收到这条信息是因为您之前设置了项目开标提醒,如果您不再需要此类提醒,可点击下方“详情”修改提醒设置。"
 	},
 	"followPushRpc": "127.0.0.1:8759",
-	"recommendThreshold": 0.5,
+	D
 	"rewardText": [
 		"憋说话!赏我!",
 		"“赏”就一个字 我只说一次",

+ 1 - 1
src/jfw/modules/bigmember/src/entity/portrait.go

@@ -49,7 +49,7 @@ func CreateSubVipPortraitManager(userid string, pageFlag, searchValue string, is
 		return nil, -1, errors.New("未知请求")
 	}
 	if pageFlag != "entDetail" { //需要权限校验的接口
-		bigMsg := jy.GetBigVipUserBaseMsg(userid, db.Mysql, db.Mgo)
+		bigMsg := jy.GetBigVipUserBaseMsg(userid, Mysql, Mgo)
 		if bigMsg.VipStatus <= 0 || bigMsg.Vip_BuySet.Upgrade != 1 { //免费用户留资体验
 			if searchValue != "" && jy.Portraitexperience(userid, searchValue, isWinner) {
 				return &Portrait{userid}, 3, nil

+ 1 - 0
src/jfw/modules/bigmember/src/service/use/use.go

@@ -7,6 +7,7 @@ import (
 	"encoding/json"
 	"entity"
 	"fmt"
+	"jfw/modules/bigmember/src/util"
 	"log"
 	"mongodb"
 	qu "qfw/util"

+ 21 - 3
src/jfw/modules/common/src/qfw/util/jy/bigVipPower.go

@@ -24,8 +24,9 @@ type BigVipBaseMsg struct {
 	HasTrial  bool         `json:"has_trial"` //是否试用过
 	Customers int          `json:"customers"` //可关注客户数量
 
-	VipStatus  int    `json:"vip_status"` //超级订阅状态
-	Vip_BuySet BuySet `json:"vip_buyset"` //超级订阅套餐内容
+	VipStatus      int    `json:"vip_status"` //超级订阅状态
+	Vip_BuySet     BuySet `json:"vip_buyset"` //超级订阅套餐内容
+	EntnicheStatus int    `json:"entniche_status"` //超级订阅状态
 
 	IsUpgrade   bool  `json:"isUpgrade"`   //是否是免费用户订阅升级用户 默认true
 	Registedate int64 `json:"registedate"` //用户注册时间
@@ -140,6 +141,23 @@ func GetBigVipUserBaseMsg(userId string, mysql *mysql.Mysql, mg MongodbSim) *Big
 			}
 		}
 	}
+	entniche:=0
+/*	res := mysql.SelectBySql(`SELECT i.name,i.phone,i.status,i.auth_status,u.power FROM entniche_user u LEFT JOIN entniche_info i
+			ON u.ent_id=i.id
+			ORDER BY  i.status DESC,i.auth_status DESC, CASE WHEN u.id=? THEN 0  ELSE 1 END  ASC`, entUserId)
+	if res != nil && len(*res) > 0 {
+		entname := qutil.ObjToString((*res)[0]["name"])
+		d["entname"] = entname
+		//已购买企业未过期-商机管理用户
+		for _, v := range *res {
+			if qutil.IntAll(v["status"]) == 1 && qutil.IntAll(v["power"]) == 1 {
+				d["isFree"] = false
+				d["entniche"] = true
+				entniche =1
+				break
+			}
+		}
+	}*/
 	//子账号查询父节点权限
 	queryId := qutil.If(userPower.Pid == "", userId, userPower.Pid).(string)
 	//用户购买的服务
@@ -167,7 +185,7 @@ func GetBigVipUserBaseMsg(userId string, mysql *mysql.Mysql, mg MongodbSim) *Big
 		userPower.DailyNum = dailyNum
 		userPower.Customers = customers
 	}
-
+	userPower.EntnicheStatus = entniche
 	//存储缓存
 	go func() {
 		if bytes, err := json.Marshal(userPower); err == nil && bytes != nil {

+ 14 - 4
src/jfw/modules/common/src/qfw/util/jy/subscribepush.go

@@ -52,15 +52,17 @@ const (
 	mongodb_fields      = `{"_id":1,"area":1,"publishtime":1,"s_subscopeclass":1,"subtype":1,"title":1,"toptype":1,"type":1, "buyerclass":1,"budget":1,"bidamount":1,"s_winner":1,"bidopentime":1,"buyer":1,"projectname":1}`
 	querys              = `{"query":{"terms":{"_id":["%s"]}},"_source":["_id","title","detail","area","city","publishtime","projectname","buyer","buyerclass","s_winner","bidamount","subtype","toptype","href","projectcode","buyerperson","buyertel","budget","bidopentime","agency","projectscope","winnerperson","winnertel"]}`
 
-	MemberFlag  = "m"
-	SubVipFlag  = "v"
-	SubFreeFlag = ""
+	MemberFlag   = "m"
+	SubVipFlag   = "v"
+	EntnicheFlag = "s"
+	SubFreeFlag  = ""
 )
 
 var aboutDbMsg map[string]*AboutDbMsg = map[string]*AboutDbMsg{
 	SubFreeFlag: &AboutDbMsg{"pushsubscribe", "subpush"},
 	SubVipFlag:  &AboutDbMsg{"pushsubscribe", "subpush"},
 	MemberFlag:  &AboutDbMsg{"pushmember", "memberpush"},
+	EntnicheFlag:  &AboutDbMsg{"pushentniche", "pushentniche"},
 }
 
 type AboutDbMsg struct {
@@ -145,6 +147,7 @@ func (s *subscribePush) todayKey(userId string) string {
 	return fmt.Sprintf("%s_%s", aboutDbMsg[s.ModuleFlag].RedisKeyFlag, userId)
 }
 func (s *subscribePush) allKey(userId string) string {
+	log.Println(fmt.Sprintf("all_%s_%s", aboutDbMsg[s.ModuleFlag].RedisKeyFlag, userId))
 	return fmt.Sprintf("all_%s_%s", aboutDbMsg[s.ModuleFlag].RedisKeyFlag, userId)
 }
 
@@ -407,13 +410,20 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 		}
 	}
 	searchSql := fmt.Sprintf(" from %s where %s order by id desc", aboutDbMsg[s.ModuleFlag].MysqlTable, strings.Join(querys, " and "))
+	fmt.Println("searchSql", searchSql)
 	//查询总数
 	count = spqp.PushMysql.CountBySql(fmt.Sprintf("select count(id)" + searchSql))
 
 	findSql := "select id,date,infoid,isvisit,matchkeys,type"
 	if s.ModuleFlag != MemberFlag {
-		findSql += ",isvip"
+		if s.ModuleFlag==EntnicheFlag{
+
+		}else{
+			findSql += ",isvip"
+		}
+
 	}
+
 	findSql += searchSql
 	if isLimit {
 		findSql += fmt.Sprintf(" limit %d,%d", (spqp.PageNum-1)*size, size)

+ 50 - 1
src/jfw/modules/common/src/qfw/util/jy/switchService.go

@@ -3,6 +3,7 @@ package jy
 import (
 	. "mongodb"
 	"qfw/util"
+	"qfw/util/mysql"
 
 	"github.com/go-xweb/httpsession"
 )
@@ -12,6 +13,7 @@ var SwitchService = &switchService{
 	Member:     "m",
 	Vip:        "v",
 	Free:       "",
+	Entniche:   "s",
 }
 
 //切换超级订阅、大会员服务
@@ -20,6 +22,7 @@ type switchService struct {
 	Member     string
 	Vip        string
 	Free       string
+	Entniche   string
 }
 
 /* 获取当前所选的服务类型
@@ -29,8 +32,10 @@ type switchService struct {
  */
 func (s *switchService) Get(session *httpsession.Session, m MongodbSim) string {
 	userId, _ := session.Get("userId").(string)
+	//entUserId := util.IntAll(this.GetSession(""))
 	v, _ := session.Get(s.SessionKey).(string)
 	u, ok := m.FindById("user", userId, `{"i_member_status":1,"i_vip_status":1}`)
+	//entniche:=false
 	if ok && u != nil {
 		if i_vip_status := util.IntAll((*u)["i_vip_status"]); v == s.Vip && i_vip_status > 0 {
 			return s.Vip
@@ -39,7 +44,47 @@ func (s *switchService) Get(session *httpsession.Session, m MongodbSim) string {
 		} else if i_vip_status > 0 {
 			session.Set(s.SessionKey, s.Vip)
 			return s.Vip
-		} else if i_member_status > 0 {
+		}else if i_member_status > 0 {
+			session.Set(s.SessionKey, s.Member)
+			return s.Member
+		}
+	}
+	session.Del(s.SessionKey)
+	return s.Free
+}
+
+func (s *switchService) GetEntniche(session *httpsession.Session, m MongodbSim,sql *mysql.Mysql) string {
+	userId, _ := session.Get("userId").(string)
+	entUserId := util.IntAll(session.Get("entUserId"))
+	v, _ := session.Get(s.SessionKey).(string)
+	u, ok := m.FindById("user", userId, `{"i_member_status":1,"i_vip_status":1}`)
+	entniche:=false
+	res := sql.SelectBySql(`SELECT i.name,i.phone,i.status,i.auth_status,u.power FROM entniche_user u LEFT JOIN entniche_info i
+			ON u.ent_id=i.id
+			ORDER BY  i.status DESC,i.auth_status DESC, CASE WHEN u.id=? THEN 0  ELSE 1 END  ASC`, entUserId)
+	if res != nil && len(*res) > 0 {
+		//已购买企业未过期-商机管理用户
+		for _, v := range *res {
+			if util.IntAll(v["status"]) == 1 && util.IntAll(v["power"]) == 1 {
+				//d["isFree"] = false
+				//d["entniche"] = true
+				entniche=true
+				break
+			}
+		}
+	}
+	if ok && u != nil {
+		if i_vip_status := util.IntAll((*u)["i_vip_status"]); v == s.Vip && i_vip_status > 0 {
+			return s.Vip
+		} else if i_member_status := util.IntAll((*u)["i_member_status"]); v == s.Member && i_member_status > 0 {
+			return s.Member
+		} else if i_vip_status > 0 {
+			session.Set(s.SessionKey, s.Vip)
+			return s.Vip
+		} else if entniche   {
+			session.Set(s.SessionKey, s.Entniche)
+			return s.Entniche
+		}else if i_member_status > 0 {
 			session.Set(s.SessionKey, s.Member)
 			return s.Member
 		}
@@ -62,3 +107,7 @@ func (s *switchService) IsVip(session *httpsession.Session, m MongodbSim) bool {
 func (s *switchService) IsFree(session *httpsession.Session, m MongodbSim) bool {
 	return s.Get(session, m) == s.Free
 }
+//所选服务是否是超级订阅
+func (s *switchService) IsEntniche(session *httpsession.Session, m MongodbSim) bool {
+	return s.Get(session, m) == s.Entniche
+}

+ 1 - 1
src/jfw/modules/publicapply/src/a/init.go

@@ -10,7 +10,7 @@ import (
 func init() {
 	//开启redissession
 	httpsession.IsRedisSessionStore = true
-	httpsession.RedisNotLoginKey = "userId"
+	httpsession.RedisNotLoginKey  = "userId"
 	xweb.Config.Profiler = true
 	xweb.RootApp().BasePath = "/publicapply"
 	xweb.RootApp().AppConfig.StaticFileVersion = false

+ 9 - 1
src/jfw/modules/publicapply/src/db.json

@@ -42,7 +42,7 @@
 	},
 	"redis": {
 		"main":{
-			"address": "other=192.168.3.206:1712,session=192.168.3.206:1712,pushcache_1=192.168.3.206:5000,pushcache_2_a=192.168.3.206:5001,pushcache_2_b=192.168.3.206:5002"
+			"address": "other=127.0.0.1:6379,session=192.168.3.206:1712,pushcache_1=192.168.3.206:5000,pushcache_2_a=192.168.3.206:5001,pushcache_2_b=192.168.3.206:5002"
 		}
 	},
 	"mysql": {
@@ -69,6 +69,14 @@
 			"passWord": "Topnet123",
 			"maxOpenConns": 5,
 			"maxIdleConns": 5
+		},
+		"entnichePush": {
+			"dbName": "jianyu",
+			"address": "192.168.3.11:3366",
+			"userName": "root",
+			"passWord": "Topnet123",
+			"maxOpenConns": 5,
+			"maxIdleConns": 5
 		}
 	},
 	"bdcollection":"bdcollection",

+ 18 - 3
src/jfw/modules/publicapply/src/db/db.go

@@ -25,9 +25,10 @@ type dbConf struct {
 		Main *redisConf
 	}
 	Mysql struct {
-		Main       *mysqlConf
-		Push       *mysqlConf
-		MemberPush *mysqlConf
+		Main         *mysqlConf
+		Push         *mysqlConf
+		MemberPush   *mysqlConf
+		EntnichePush *mysqlConf
 	}
 	Bdcollection string
 	Bdlabel      string
@@ -68,6 +69,7 @@ var (
 	Mysql           *mysql.Mysql
 	MysqlPush       *mysql.Mysql
 	MysqlMemberPush *mysql.Mysql
+	MysqlEntnichePush *mysql.Mysql
 )
 
 func init() {
@@ -172,5 +174,18 @@ func init() {
 			MysqlMemberPush.Init()
 			jy.PushMapping.Init(MysqlMemberPush)
 		}
+		if DbConf.Mysql.EntnichePush != nil {
+			log.Println("初始化 mysql Entniche push")
+			MysqlEntnichePush = &mysql.Mysql{
+				Address:      DbConf.Mysql.EntnichePush.Address,
+				UserName:     DbConf.Mysql.EntnichePush.UserName,
+				PassWord:     DbConf.Mysql.EntnichePush.PassWord,
+				DBName:       DbConf.Mysql.EntnichePush.DbName,
+				MaxOpenConns: DbConf.Mysql.EntnichePush.MaxOpenConns,
+				MaxIdleConns: DbConf.Mysql.EntnichePush.MaxIdleConns,
+			}
+			MysqlEntnichePush.Init()
+			jy.PushMapping.Init(MysqlEntnichePush)
+		}
 	}
 }

+ 3 - 0
src/jfw/modules/publicapply/src/filter/sessionfilter.go

@@ -22,6 +22,9 @@ func (l *sessionfilter) Do(w http.ResponseWriter, req *http.Request) bool {
 		return true
 	}
 	session := l.App.SessionManager.Session(req, w)
+	/*session.Set("userId","61303ffcad25eb5bfe058dc5")
+	session.Set("entUserId","171")
+	session.Set("entUserId","3602")*/
 	userId, ok := session.Get("userId").(string)
 	if !ok || userId == "" {
 		R.ServeJson(w, req, &Result{Error_code_1004, Error_msg_1004, nil})

+ 0 - 1
src/jfw/modules/publicapply/src/main.go

@@ -9,7 +9,6 @@ import (
 	. "config"
 	_ "customer"
 	_ "dataexport"
-	_ "db"
 	_ "drainage"
 	_ "enterpriseSearch"
 	_ "filter"

+ 4 - 1
src/jfw/modules/publicapply/src/subscribePush/entity/historyPush.go

@@ -17,8 +17,11 @@ var HistoryPush = &historyPush{}
 func (hp *historyPush) UpdateUserPushUnread(userid string, vt string) {
 	if vt == jy.MemberFlag {
 		db.Mgo.UpdateById("user", userid, map[string]interface{}{"$set": map[string]interface{}{"i_member_apppushunread": 0}})
-	} else {
+	} else  if vt ==jy.EntnicheFlag{
+		db.Mgo.UpdateById("user", userid, map[string]interface{}{"$set": map[string]interface{}{"i_entniche_apppushunread": 0}})
+	}else{
 		db.Mgo.UpdateById("user", userid, map[string]interface{}{"$set": map[string]interface{}{"i_apppushunread": 0}})
+
 	}
 }
 

+ 28 - 11
src/jfw/modules/publicapply/src/subscribePush/service/pushList.go

@@ -18,18 +18,17 @@ import (
 
 type SubscribePush struct {
 	*xweb.Action
-	hasPushHistory xweb.Mapper `xweb:"/subscribe/historyPush"`   //推送历史查询
-	historyPaging  xweb.Mapper `xweb:"/subscribe/historyPaging"` //推送历史翻页
-	setRead        xweb.Mapper `xweb:"/subscribe/setRead"`       //推送记录已读
-	keywordUpdate  xweb.Mapper `xweb:"/subscribe/keywordUpdate"` //订阅词修改
-	pushSetting    xweb.Mapper `xweb:"/subscribe/pushSetting"`   //推送设置
-	vipSwitch      xweb.Mapper `xweb:"/subscribe/vipSwitch"`     //大会员、超级订阅切换
-
+	hasPushHistory  xweb.Mapper `xweb:"/subscribe/historyPush"`         //推送历史查询
+	historyPaging   xweb.Mapper `xweb:"/subscribe/historyPaging"`       //推送历史翻页
+	setRead         xweb.Mapper `xweb:"/subscribe/setRead"`             //推送记录已读
+	keywordUpdate   xweb.Mapper `xweb:"/subscribe/keywordUpdate"`       //订阅词修改
+	pushSetting     xweb.Mapper `xweb:"/subscribe/pushSetting"`         //推送设置
+	vipSwitch       xweb.Mapper `xweb:"/subscribe/vipSwitch"`           //大会员、超级订阅切换
 	getPushCount    xweb.Mapper `xweb:"/subscribe/keyset/getPushCount"` //近3个月匹配数量【某组关键词】
 	getPushAllCount xweb.Mapper `xweb:"/subscribe/getPushAllCount"`     //全部关键词-推送结果预览总数
 }
 
-//VipSwitch 大会员、超级订阅切换
+//VipSwitch 大会员、超级订阅、商机管理切换
 func (sp *SubscribePush) VipSwitch() {
 	userId, _ := sp.GetSession("userId").(string)
 	rData, errMsg := func() (interface{}, error) {
@@ -39,7 +38,7 @@ func (sp *SubscribePush) VipSwitch() {
 		switchOk := false
 		vt := sp.GetString("vt")
 		if vt == "" {
-			jy.SwitchService.Get(sp.Session(), db.Mgo)
+			jy.SwitchService.GetEntniche(sp.Session(), db.Mgo,db.Mysql)
 		} else if vt == jy.SubVipFlag {
 			vipMsg := jy.GetBigVipUserBaseMsg(userId, db.Mysql, db.Mgo)
 			if vipMsg.VipStatus <= 0 {
@@ -54,6 +53,13 @@ func (sp *SubscribePush) VipSwitch() {
 			}
 			sp.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Member)
 			switchOk = true
+		} else if vt == jy.EntnicheFlag {
+			vipMsg := jy.GetBigVipUserBaseMsg(userId, db.Mysql, db.Mgo)
+			if vipMsg.EntnicheStatus <= 0 {
+				return nil, fmt.Errorf("未购买商机管理")
+			}
+			sp.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Member)
+			switchOk = true
 		} else {
 			return nil, fmt.Errorf("未知请求")
 		}
@@ -68,7 +74,7 @@ func (sp *SubscribePush) VipSwitch() {
 	sp.ServeJson(NewResult(rData, errMsg))
 }
 
-//HasPushHistory 大会员、超级订阅推送历史 (原wx推送更改)
+//HasPushHistory 大会员、超级订阅,商机管理推送历史 (原wx推送更改)
 func (sp *SubscribePush) HasPushHistory() {
 	userId := util.ObjToString(sp.GetSession("userId"))
 	if userId == "" {
@@ -76,7 +82,10 @@ func (sp *SubscribePush) HasPushHistory() {
 	}
 	vipType := sp.GetString("vt")
 	if vipType == "" { //默认取已切换的企业
-		vipType = jy.SwitchService.Get(sp.Session(), db.Mgo)
+		vipType = jy.SwitchService.GetEntniche(sp.Session(), db.Mgo,db.Mysql)
+	}
+	if vipType==jy.SwitchService.Entniche{
+		userId = util.ObjToString(sp.GetSession("entUserId"))
 	}
 	go entity.HistoryPush.UpdateUserPushUnread(userId, vipType)
 	user, _ := jy.NewSubscribePush().UserInfo(db.Mgo, userId)
@@ -121,6 +130,7 @@ func (sp *SubscribePush) HasPushHistory() {
 			isPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+todayNum+"_"+userId) >= 150
 		}
 	}
+
 	//推送记录查询
 	pageNum, _ := sp.GetInteger("pageNum")
 	spqp := &jy.SubPushQueryParam{
@@ -139,6 +149,8 @@ func (sp *SubscribePush) HasPushHistory() {
 	}
 	if vipType == jy.SwitchService.Member {
 		spqp.PushMysql = db.MysqlMemberPush
+	} else if vipType == jy.SwitchService.Entniche {
+		spqp.PushMysql = db.MysqlEntnichePush
 	} else {
 		spqp.PushMysql = db.MysqlPush
 	}
@@ -191,6 +203,9 @@ func (sp *SubscribePush) HistoryPaging() {
 	if vipType == "" { //默认取已切换的企业
 		vipType = jy.SwitchService.Get(sp.Session(), db.Mgo)
 	}
+	if vipType==jy.SwitchService.Entniche{
+		userId = util.ObjToString(sp.GetSession("entUserId"))
+	}
 	pageNum, _ := sp.GetInteger("pageNum")
 	PageSize, _ := sp.GetInteger("pageSize")
 	if pageNum == 1 {
@@ -213,6 +228,8 @@ func (sp *SubscribePush) HistoryPaging() {
 	}
 	if vipType == jy.SwitchService.Member {
 		spqp.PushMysql = db.MysqlMemberPush
+	} else if vipType == jy.SwitchService.Entniche {
+		spqp.PushMysql = db.MysqlEntnichePush
 	} else {
 		spqp.PushMysql = db.MysqlPush
 	}