|
@@ -137,10 +137,10 @@ type EntFollowGroup struct {
|
|
|
// GetEntFollowList 我关注的企业列表
|
|
|
// param A默认分组 B竞争对手 C合作伙伴 逗号分隔
|
|
|
// db 0||nil 默认分组、1 竞争对手、2 合作伙伴、3 竞争对手和合作伙伴
|
|
|
-func (this *EntFollow) GetEntFollowList(pNum, pSize int, match, groups string) (followData []map[string]interface{}, hasNext bool, count, total int, groupUserArr []EntFollowGroup, err error) {
|
|
|
+func (this *EntFollow) GetEntFollowList(pNum, pSize int, match, groups string) (followData []map[string]interface{}, hasNext bool, count, total int, err error) {
|
|
|
groupIds, groupErr := checkGroup(this.UserId, groups, true)
|
|
|
if groupErr != nil {
|
|
|
- return nil, false, -1, -1, nil, fmt.Errorf("分组不存在")
|
|
|
+ return nil, false, -1, -1, fmt.Errorf("分组不存在")
|
|
|
}
|
|
|
flistSql := fmt.Sprintf(`SELECT m.*,GROUP_CONCAT(g.id SEPARATOR ',') as gs from follow_ent_monitor m inner join follow_ent_monitor_group g on(m.s_userid =g.s_userid and g.s_userid ='%s') INNER JOIN follow_ent_monitor_relationship r on ( g.id=r.s_groupId and m.s_entId=r.s_entId ) GROUP BY s_entId ORDER BY m.l_lastpushtime DESC,m.l_createtime DESC LIMIT %d,%d`, this.UserId, 0, this.MaxNum)
|
|
|
log.Print("我关注的企业列表开始查询:", flistSql)
|
|
@@ -155,13 +155,6 @@ func (this *EntFollow) GetEntFollowList(pNum, pSize int, match, groups string) (
|
|
|
var (
|
|
|
followDataAll []map[string]interface{}
|
|
|
)
|
|
|
- groupMap := make(map[string]int)
|
|
|
- data := db.Base.SelectBySql(fmt.Sprintf(`SELECT id,s_name,isPut FROM follow_ent_monitor_group WHERE s_userid = '%s' ORDER BY isdefGoup desc, create_time desc`, this.UserId))
|
|
|
- if data != nil && len(*data) > 0 {
|
|
|
- for _, m := range *data {
|
|
|
- groupMap[qutil.InterfaceToStr(m["id"])] = 0
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
for _, item := range *res {
|
|
|
//兼容从大会员变成免费用户时筛选条件数据错乱问题 取数据全部取出后在进行筛选过滤
|
|
@@ -173,17 +166,12 @@ func (this *EntFollow) GetEntFollowList(pNum, pSize int, match, groups string) (
|
|
|
|
|
|
var (
|
|
|
enCodeGroups []string
|
|
|
- groups = strings.Split(gconv.String(item["gs"]), ",")
|
|
|
)
|
|
|
- //数据存在于哪个分组中 计数
|
|
|
- for _, group := range groups {
|
|
|
- if _, ok := groupMap[group]; ok {
|
|
|
- groupMap[qutil.InterfaceToStr(group)]++
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
if len(groupIds) > 0 {
|
|
|
var (
|
|
|
- has = false
|
|
|
+ has = false
|
|
|
+ groups = strings.Split(gconv.String(item["gs"]), ",")
|
|
|
)
|
|
|
for _, group := range groups {
|
|
|
if group != "" {
|
|
@@ -220,17 +208,6 @@ func (this *EntFollow) GetEntFollowList(pNum, pSize int, match, groups string) (
|
|
|
followDataAll = append(followDataAll, rowMap)
|
|
|
}
|
|
|
|
|
|
- if data != nil && len(*data) > 0 {
|
|
|
- for _, m := range *data {
|
|
|
- groupUserArr = append(groupUserArr, EntFollowGroup{
|
|
|
- util.EncodeId(qutil.InterfaceToStr(m["id"])),
|
|
|
- qutil.InterfaceToStr(m["s_name"]),
|
|
|
- qutil.IntAll(m["isPut"]),
|
|
|
- groupMap[qutil.InterfaceToStr(m["id"])],
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
total = len(followDataAll)
|
|
|
//分页
|
|
|
if total > 0 {
|
|
@@ -871,3 +848,37 @@ func (this *EntFollow) DelLabelGroup(groupId string) error {
|
|
|
}
|
|
|
return err
|
|
|
}
|
|
|
+
|
|
|
+func (this *EntFollow) GetFollowGroupList() (groupUserArr []EntFollowGroup, err error) {
|
|
|
+ groupMap := make(map[int]int)
|
|
|
+ flistSql := fmt.Sprintf(`SELECT m.s_entId,g.id as groupId from follow_ent_monitor m inner join follow_ent_monitor_group g on(m.s_userid =g.s_userid and g.s_userid ='%s') INNER JOIN follow_ent_monitor_relationship r on ( g.id=r.s_groupId and m.s_entId=r.s_entId ) GROUP BY s_entId ORDER BY m.l_lastpushtime DESC,m.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 {
|
|
|
+ for _, m := range *res {
|
|
|
+ groupMap[qutil.IntAll(m["groupId"])]++
|
|
|
+ }
|
|
|
+ }
|
|
|
+ data := db.Base.SelectBySql(fmt.Sprintf(`SELECT
|
|
|
+ a.id,
|
|
|
+ a.isPut,
|
|
|
+ a.s_name
|
|
|
+FROM
|
|
|
+ follow_ent_monitor_group a
|
|
|
+WHERE
|
|
|
+ a.s_userid = '%s'
|
|
|
+ORDER BY
|
|
|
+ a.isdefGoup DESC,
|
|
|
+ a.create_time DESC`, this.UserId))
|
|
|
+ if data != nil && len(*data) > 0 {
|
|
|
+ for _, m := range *data {
|
|
|
+ groupUserArr = append(groupUserArr, EntFollowGroup{
|
|
|
+ util.EncodeId(qutil.InterfaceToStr(m["id"])),
|
|
|
+ qutil.InterfaceToStr(m["s_name"]),
|
|
|
+ qutil.IntAll(m["isPut"]),
|
|
|
+ groupMap[qutil.IntAll(m["id"])],
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|