Quellcode durchsuchen

feat:企业关注

wangshan vor 2 Jahren
Ursprung
Commit
5b99a88e28
1 geänderte Dateien mit 2 neuen und 99 gelöschten Zeilen
  1. 2 99
      src/jfw/modules/bigmember/src/entity/followEnterprise.go

+ 2 - 99
src/jfw/modules/bigmember/src/entity/followEnterprise.go

@@ -117,8 +117,8 @@ func (this *EntFollow) EntFollowedShow(entId string) (followed, showFollow bool,
 // param A默认分组 B竞争对手 C合作伙伴 逗号分隔
 // db  0||nil 默认分组、1 竞争对手、2 合作伙伴、3 竞争对手和合作伙伴
 func (this *EntFollow) GetEntFollowList(pNum, pSize int, match, group string) (followData []map[string]interface{}, hasNext bool, count, total int, err error) {
-	log.Print("我关注的企业列表开始查询")
 	flistSql := fmt.Sprintf(`SELECT id,f_capital,i_apppushunread,l_establishdate,l_lastpushtime,s_area,s_city,s_employeeno,s_entId,s_entname,i_group,s_phone FROM follow_ent_monitor WHERE  s_userid="%s" ORDER BY l_lastpushtime DESC,l_createtime DESC LIMIT %d,%d`, this.UserId, 0, this.MaxNum)
+	log.Print("我关注的企业列表开始查询:", flistSql)
 	res := db.Base.SelectBySql(flistSql)
 	if res == nil || len(*res) == 0 {
 		//err = errors.New("查询异常")
@@ -126,39 +126,7 @@ func (this *EntFollow) GetEntFollowList(pNum, pSize int, match, group string) (f
 	}
 	log.Print("我关注的企业列表查询结束")
 	count = len(*res)
-	//var names []string
-	//for _, data := range *res {
-	//	if data["s_area"] == nil || data["s_city"] == nil || data["s_phone"] == nil || data["s_employeeno"] == nil || data["f_capital"] == nil {
-	//		//根据企业名字查询企业信息
-	//		names = append(names, qutil.ObjToString(data["s_entname"]))
-	//	}
-	//}
-	//
-	//fullData := getEntMsgByNames(names)
-	//if group != "" {
-	//		var igroup string
-	//		if strings.Index(group, "A") > -1 {
-	//			igroup = `i_group = 0 AND`
-	//		}
-	//		if strings.Index(group, "B") > -1 && strings.Index(group, "C") > -1 {
-	//			igroup = `(i_group = 1 OR i_group = 2 OR i_group = 3 ) AND`
-	//		} else {
-	//			if strings.Index(group, "B") > -1 {
-	//				igroup = `(i_group = 1 OR i_group = 3 ) AND`
-	//			} else if strings.Index(group, "C") > -1 {
-	//				igroup = `(i_group = 2 OR i_group = 3 ) AND`
-	//			}
-	//		}
-	//		flistSql = fmt.Sprintf(flistSql, igroup)
-	//		countSql = fmt.Sprintf(countSql, igroup)
-	//	} else {
-	//		flistSql = fmt.Sprintf(flistSql, ``)
-	//		countSql = fmt.Sprintf(countSql, ``)
-	//	}
-	// if match = strings.TrimSpace(match); match != "" {
-	//        flistSql = flistSql + `AND s_entname LIKE "%` + match + `%"`
-	//        countSql = countSql + `AND s_entname LIKE "%` + match + `%"`
-	//    }
+
 	var followDataAll []map[string]interface{}
 	for _, item := range *res {
 		//兼容从大会员变成免费用户时筛选条件数据错乱问题 取数据全部取出后在进行筛选过滤
@@ -215,71 +183,6 @@ func (this *EntFollow) GetEntFollowList(pNum, pSize int, match, group string) (f
 	}
 
 	hasNext = qutil.If((pNum+1)*pSize >= len(followDataAll), false, true).(bool)
-	/*if this.HasPower { //购买企业情报的用户直接查询
-	  	res, _ := db.Mgo.Find(this.SaveTable, query, `{"l_lastpushtime":-1}`, `{"_id":1,"s_entname":1,"s_area":1,"s_city":1,"s_phone":1,"f_capital":1,"s_employeeno":1,"l_establishdate":1,"i_apppushunread":1,"s_entId":1,"l_lastpushtime":1,"i_group":1}`, false, pNum*size, pSize)
-	  	if res == nil || len(*res) == 0 {
-	  		err = errors.New("查询异常")
-	  		return
-	  	}
-	  	//followData = *res
-	  	//加密entId
-	  	for _, item := range *res {
-	  		entId := qutil.ObjToString(item["s_entId"])
-	  		if entId == "" { //dev3.6.2 前关注企业未存入企业id
-	  			//查询企业entid
-	  			entId = this.updateFollowed(item)
-	  		}
-	  		followData = append(followData, map[string]interface{}{
-	  			"fid":             util.EncodeId(mongodb.BsonIdToSId(item["_id"])),
-	  			"s_entId":         util.EncodeId(entId),
-	  			"f_capital":       item["f_capital"],
-	  			"l_establishdate": item["l_establishdate"],
-	  			"s_area":          item["s_area"],
-	  			"s_city":          item["s_city"],
-	  			"s_employeeno":    item["s_employeeno"],
-	  			"s_entname":       item["s_entname"],
-	  			"s_phone":         item["s_phone"],
-	  			"i_apppushunread": item["i_apppushunread"],
-	  			"l_lastpushtime":  item["l_lastpushtime"],
-	  			"s_group":         parseGroupStr(qutil.IntAll(item["i_group"])),
-	  		})
-	  	}
-	  } else { //免费用户根据企业名称 二次查询企业id、成立时间等数据
-	  	res, _ := db.Mgo.Find(this.SaveTable, query, `{"l_lastpushtime":-1}`, `{"_id":1,"s_entname":1,"i_apppushunread":1,"l_lastpushtime":1,"i_group":1}`, false, pNum*size, pSize)
-	  	if res == nil || len(*res) == 0 {
-	  		err = errors.New("查询异常")
-	  		return
-	  	}
-	  	//根据企业名字查询企业信息
-	  	var names []string
-	  	for _, data := range *res {
-	  		names = append(names, qutil.ObjToString(data["s_entname"]))
-	  	}
-	  	fullData := getEntMsgByNames(names)
-
-	  	for _, item := range *res {
-	  		entName, _ := item["s_entname"].(string)
-	  		rowMap := map[string]interface{}{
-	  			"fid":             util.EncodeId(mongodb.BsonIdToSId(item["_id"])),
-	  			"s_entname":       entName,
-	  			"i_apppushunread": item["i_apppushunread"],
-	  			"l_lastpushtime":  item["l_lastpushtime"],
-	  			"s_group":         parseGroupStr(qutil.IntAll(item["i_group"])),
-	  		}
-	  		if supplement, ok := fullData[entName]; ok {
-	  			//企业id
-	  			if entId, _ := supplement["_id"].(string); entId != "" {
-	  				rowMap["s_entId"] = util.EncodeId(entId)
-	  			}
-	  			rowMap["l_establishdate"] = supplement["establish_date"] //成立时间
-	  			rowMap["f_capital"] = supplement["capital"]              //注册资本
-	  			rowMap["s_area"] = supplement["company_area"]            //企业省份
-	  			rowMap["s_city"] = supplement["company_city"]            //城市
-	  			rowMap["s_phone"] = supplement["company_phone"]          //企业电话
-	  		}
-	  		followData = append(followData, rowMap)
-	  	}
-	  }*/
 	return
 }