|
@@ -88,19 +88,28 @@ func (this *EntFollow) GetAssociationEnt(entName string) ([]map[string]interface
|
|
|
// EntFollowedShow 详情页查询是否关注企业
|
|
|
// followed 是否已关注
|
|
|
// showFollow 是否展示关注(检索库存在相关企业信息时展示)
|
|
|
-func (this *EntFollow) EntFollowedShow(entId string) (followed, showFollow bool, err error) {
|
|
|
+func (this *EntFollow) EntFollowedShow(entId string) (followed, showFollow bool, followedGroup string, err error) {
|
|
|
if entId == "" {
|
|
|
err = errors.New("未查询到企业")
|
|
|
return
|
|
|
}
|
|
|
- query := map[string]interface{}{"s_entId": entId, "s_userid": this.UserId}
|
|
|
- fRes := db.Base.FindOne(this.SaveTable, query, "i_apppushunread", "")
|
|
|
+ //query := map[string]interface{}{"s_entId": entId, "s_userid": this.UserId}
|
|
|
+ //fRes := db.Base.FindOne(this.SaveTable, query, "i_apppushunread", "")
|
|
|
+ fRes := db.Base.SelectBySql(fmt.Sprintf(`SELECT a.i_apppushunread,c.s_name FROM %s a
|
|
|
+INNER JOIN follow_ent_monitor_relationship b on (a.s_entId = b.s_entId)
|
|
|
+INNER JOIN follow_ent_monitor_group c on (b.s_groupId = c.id and a.s_userid = c.s_userid)
|
|
|
+WHERE a.s_entId = '%s' and a.s_userid = '%s'`, this.SaveTable, entId, this.UserId))
|
|
|
followed = false
|
|
|
if fRes != nil {
|
|
|
followed = true
|
|
|
+ var names []string
|
|
|
+ for _, m := range *fRes {
|
|
|
+ names = append(names, qutil.ObjToString(m["s_name"]))
|
|
|
+ }
|
|
|
+ followedGroup = strings.Join(names, ",")
|
|
|
//已关注,并且有未读标示
|
|
|
- if qutil.IntAll((*fRes)["i_apppushunread"]) > 0 {
|
|
|
- go db.Base.Update(this.SaveTable, query, map[string]interface{}{
|
|
|
+ if qutil.IntAll((*fRes)[0]["i_apppushunread"]) > 0 {
|
|
|
+ go db.Base.Update(this.SaveTable, map[string]interface{}{"s_entId": entId, "s_userid": this.UserId}, map[string]interface{}{
|
|
|
"i_apppushunread": 0,
|
|
|
})
|
|
|
}
|