|
@@ -701,6 +701,7 @@ func (this *EntFollow) GetFollowEntInfo() (used int64, surplus int64) {
|
|
|
|
|
|
func (this *EntFollow) GetLabelGroup() *[]map[string]interface{} {
|
|
func (this *EntFollow) GetLabelGroup() *[]map[string]interface{} {
|
|
defIdMap := make(map[int]bool)
|
|
defIdMap := make(map[int]bool)
|
|
|
|
+ //检测默认分组 初始化
|
|
count := db.Base.Count("follow_ent_monitor_group", map[string]interface{}{
|
|
count := db.Base.Count("follow_ent_monitor_group", map[string]interface{}{
|
|
"s_userid": this.UserId,
|
|
"s_userid": this.UserId,
|
|
"isdefGoup": 1,
|
|
"isdefGoup": 1,
|
|
@@ -743,15 +744,8 @@ INNER JOIN follow_ent_monitor_group c on c.s_userid = '%s' and c.id = b.s_grou
|
|
}
|
|
}
|
|
|
|
|
|
func (this *EntFollow) AddLabelGroup(name string) error {
|
|
func (this *EntFollow) AddLabelGroup(name string) error {
|
|
- if db.Base.Count("follow_ent_monitor_group", map[string]interface{}{
|
|
|
|
- "user_id": this.UserId,
|
|
|
|
- "isdefGoup": 1,
|
|
|
|
- }) == 0 { //初始化默认分组
|
|
|
|
- db.Base.SelectBySql(fmt.Sprintf(`INSERT INTO follow_ent_monitor_group (s_name, s_userid, create_time, update_time, isPut, isdefGoup) VALUES
|
|
|
|
-('默认分组', '%s', '2025-01-03 12:00:00', '2025-01-13 12:00:00', 0, 1),
|
|
|
|
-('竞争对手', '%s', '2024-01-02 12:00:00', '2025-01-13 12:00:00', 1, 0),
|
|
|
|
-('合作伙伴', '%s', '2024-01-01 12:00:00', '2025-01-13 12:00:00', 1, 0);`, this.UserId, this.UserId, this.UserId))
|
|
|
|
- }
|
|
|
|
|
|
+ //检测默认分组 初始花
|
|
|
|
+ DefaultGroupInit(this.UserId)
|
|
if db.Base.Count("follow_ent_monitor_group", map[string]interface{}{
|
|
if db.Base.Count("follow_ent_monitor_group", map[string]interface{}{
|
|
"user_id": this.UserId,
|
|
"user_id": this.UserId,
|
|
"s_name": name,
|
|
"s_name": name,
|
|
@@ -851,6 +845,7 @@ func (this *EntFollow) DelLabelGroup(groupId string) error {
|
|
|
|
|
|
func (this *EntFollow) GetFollowGroupList() (groupUserArr []EntFollowGroup, err error) {
|
|
func (this *EntFollow) GetFollowGroupList() (groupUserArr []EntFollowGroup, err error) {
|
|
groupMap := make(map[int]int)
|
|
groupMap := make(map[int]int)
|
|
|
|
+ DefaultGroupInit(this.UserId)
|
|
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)
|
|
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)
|
|
log.Print("我关注的企业列表开始查询:", flistSql)
|
|
res := db.Base.SelectBySql(flistSql)
|
|
res := db.Base.SelectBySql(flistSql)
|
|
@@ -882,3 +877,15 @@ ORDER BY
|
|
}
|
|
}
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+func DefaultGroupInit(userId string) {
|
|
|
|
+ if db.Base.Count("follow_ent_monitor_group", map[string]interface{}{
|
|
|
|
+ "user_id": userId,
|
|
|
|
+ "isdefGoup": 1,
|
|
|
|
+ }) == 0 { //初始化默认分组
|
|
|
|
+ db.Base.SelectBySql(fmt.Sprintf(`INSERT INTO follow_ent_monitor_group (s_name, s_userid, create_time, update_time, isPut, isdefGoup) VALUES
|
|
|
|
+('默认分组', '%s', '2025-01-03 12:00:00', '2025-01-13 12:00:00', 0, 1),
|
|
|
|
+('竞争对手', '%s', '2024-01-02 12:00:00', '2025-01-13 12:00:00', 1, 0),
|
|
|
|
+('合作伙伴', '%s', '2024-01-01 12:00:00', '2025-01-13 12:00:00', 1, 0);`, userId, userId, userId))
|
|
|
|
+ }
|
|
|
|
+}
|