Explorar o código

Merge branch 'dev3.0.0' of http://192.168.3.207:10080/qmx/jy into dev3.0.0

zhangxinlei1996 %!s(int64=4) %!d(string=hai) anos
pai
achega
9be098e2f7

+ 1 - 0
src/jfw/modules/bigmember/src/filter/sessionfilter.go

@@ -24,6 +24,7 @@ var wisdomReg = regexp.MustCompile("^/bigmember/(forecast|portrait|decision)/.+$
 
 //继承过滤器方法
 func (l *sessionfilter) Do(w http.ResponseWriter, req *http.Request) bool {
+	return true
 	session := l.App.SessionManager.Session(req, w)
 	userId, _ := session.Get("userId").(string)
 	status := util.Power(userId) //1:专家版,2:智慧版,3:商机版,

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

@@ -18,6 +18,7 @@ type Analysis struct {
 	pName       xweb.Mapper `xweb:"/analysis/projectName"` //根据项目名称关键词连带项目名称
 	pInfo       xweb.Mapper `xweb:"/analysis/projectInfo"` //根据项目名称获取项目信息
 	csORRsList  xweb.Mapper `xweb:"/potential/corList"`    //潜在客户customers or 潜在竞争对手rivals
+	rMyRivals   xweb.Mapper `xweb:"/potential/rMyRivals"`  //移除我的潜在竞争对手rivals
 	decInfo     xweb.Mapper `xweb:"/decision/decInfo"`     //投标决策分析
 	forPList    xweb.Mapper `xweb:"/forecast/forPList"`    //新项目预测结果list
 	forPContent xweb.Mapper `xweb:"/forecast/forPContent"` //新项目预测结果详情

+ 60 - 8
src/jfw/modules/bigmember/src/service/analysis/potential.go

@@ -9,6 +9,8 @@ import (
 	qutil "qfw/util"
 	"qfw/util/redis"
 	"time"
+
+	"go.mongodb.org/mongo-driver/bson"
 )
 
 type SelectC struct {
@@ -20,6 +22,37 @@ type SelectC struct {
 	PCOR           string
 }
 
+//移除我的潜在对手
+func (this *Analysis) RMyRivals() {
+	defer qutil.Catch()
+	var regMap = Result{
+		Data:       []map[string]interface{}{},
+		Error_code: Error_code,
+		Error_msg:  "",
+	}
+	if this.Method() == METHOD {
+		entName := this.GetString("entName")
+		userId, _ := this.GetSession("userId").(string)
+		if entName != "" {
+			ok := db.Mgo.Update(C_Member, `{"userid":"`+userId+`"}`, bson.M{
+				"$push": bson.M{
+					"outMyRivals": entName,
+				},
+			}, false, false)
+			regMap.Data = map[string]interface{}{
+				"success": ok,
+			}
+		} else {
+			regMap.Error_code = Error_code_1002
+			regMap.Error_msg = Error_msg_1002
+		}
+	} else {
+		regMap.Error_code = Error_code_1005
+		regMap.Error_msg = Error_msg_1005
+	}
+	this.ServeJson(regMap)
+}
+
 //潜在客户
 func (this *Analysis) CsORRsList() {
 	defer qutil.Catch()
@@ -79,8 +112,10 @@ func (this *Analysis) CsORRsList() {
 						} //查库获得大会员用户的行业信息
 						entInfo, ok := db.Mgo.FindOneByField(C_Member, `{"userid":"`+userId+`"}`, `{"entname":1,"industry":1}`)
 						if ok && entInfo != nil {
-							entName = (*entInfo)["entname"].(string)
-							if len(industry) == 0 {
+							if (*entInfo)["entname"] != nil {
+								entName = (*entInfo)["entname"].(string)
+							}
+							if len(industry) == 0 && (*entInfo)["industry"] != nil {
 								industry = qutil.ObjArrToStringArr((*entInfo)["industry"].([]interface{})) //行业
 							}
 						}
@@ -151,7 +186,8 @@ func getPRivals(userId string, potRivQ string) []PTComs {
 	var regMap = []PTComs{}
 	//我关注的企业
 	MyFollowEnts := getMyFollowEnts(userId)
-	log.Println(MyFollowEnts)
+	//非我的潜在竞争对手
+	OutLMyRivals := gerOutLMyRivals(userId)
 	aggs, _ := GetAggs(P_INDEX, P_TYPE, potRivQ)
 	if aggs != nil {
 		if aggsMap_g, ok := aggs.Children("group_field"); ok {
@@ -160,7 +196,7 @@ func getPRivals(userId string, potRivQ string) []PTComs {
 			if len(bs) > 0 {
 				json.Unmarshal(bs, &aggsMap)
 				if len(aggsMap) > 0 {
-					regMap = analysisData(aggsMap, MyFollowEnts)
+					regMap = analysisData(aggsMap, MyFollowEnts, OutLMyRivals)
 				}
 			}
 		}
@@ -168,6 +204,18 @@ func getPRivals(userId string, potRivQ string) []PTComs {
 	return regMap
 }
 
+//非我的潜在竞争对手
+func gerOutLMyRivals(userId string) map[string]interface{} {
+	var OutLMyRivals = map[string]interface{}{}
+	entData, ok := db.Mgo.FindOne(C_Member, `{"userid":"`+userId+`"}`)
+	if ok && entData != nil && (*entData)["outMyRivals"] != nil {
+		for _, v := range qutil.ObjArrToStringArr((*entData)["outMyRivals"].([]interface{})) {
+			OutLMyRivals[v] = true
+		}
+	}
+	return OutLMyRivals
+}
+
 //获取我关注的企业
 func getMyFollowEnts(userId string) map[string]interface{} {
 	var MyEntInfo = map[string]interface{}{}
@@ -195,7 +243,7 @@ func getPCostomers(userId, entName string, potComQ string) []PTComs {
 			if len(bs) > 0 {
 				json.Unmarshal(bs, &aggsMap)
 				if len(aggsMap) > 0 {
-					regMap = analysisData(aggsMap, MyCustomers)
+					regMap = analysisData(aggsMap, MyCustomers, nil)
 				}
 			}
 		}
@@ -246,13 +294,17 @@ type PTComs struct {
 }
 
 //
-func analysisData(res []map[string]interface{}, mycs map[string]interface{}) []PTComs {
+func analysisData(res []map[string]interface{}, mycs map[string]interface{}, omyr map[string]interface{}) []PTComs {
 	var ADRes = new([]PTComs)
 	for _, v := range res {
 		var ptcs = new(PTComs)
 		var buyer_val = qutil.ObjToString(v["key"]) //采购单位
-		//排除我的客户
-		if mycs[buyer_val] != nil {
+		//排除我的客户 和 我的企业情报数据
+		if mycs != nil && mycs[buyer_val] != nil {
+			continue
+		}
+		//排除移除的我的潜在竞争对手
+		if omyr != nil && omyr[buyer_val] != nil {
 			continue
 		}
 		var budget_val = qutil.ObjToMap(v["count"])    //预算总金额

+ 4 - 2
src/jfw/modules/bigmember/src/service/portrait/entPortraitAction.go

@@ -4,9 +4,10 @@ import (
 	. "api"
 	"entity"
 	"errors"
-	"github.com/go-xweb/xweb"
 	"log"
 	qutil "qfw/util"
+
+	"github.com/go-xweb/xweb"
 )
 
 //企业画像接口
@@ -47,7 +48,8 @@ func (this *EntPortrait) EntChange() {
 		if err != nil {
 			return nil, err
 		}
-		if cepm.VipStatus != 3 {
+		//套餐一  全部权限
+		if cepm.VipStatus != 1 {
 			return nil, errors.New("没有权限")
 		}
 		msg, err := cepm.GetEntChangeMsg(this.GetString("entName"))