|
@@ -513,6 +513,14 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
|
find_in_set = append(find_in_set, fmt.Sprintf("find_in_set('%s',replace(a.matchkeys,' ',','))", v))
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if spqp.Item != "" {
|
|
|
+ //通过分类名搜索
|
|
|
+ keyArr := s.ItemToKey(spqp)
|
|
|
+ for _, v := range strings.Split(keyArr, ",") {
|
|
|
+ find_in_set = append(find_in_set, fmt.Sprintf("find_in_set('%s',replace(a.matchkeys,' ',','))", v))
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if len(find_in_set) == 1 {
|
|
|
querys = append(querys, find_in_set[0])
|
|
@@ -932,49 +940,31 @@ func (s *subscribePush) SetRead(newUserId, id int64, userId, entUserId, entId st
|
|
|
if newUserId == 0 {
|
|
|
return nil
|
|
|
}
|
|
|
- if isEnt {
|
|
|
- if s.ModuleFlag == EntnicheFlag {
|
|
|
- IC.BaseServiceMysql.UpdateOrDeleteBySql(fmt.Sprintf("update %s set isvisit=1 ,visittime=now() where entid=? and id=?", aboutDbMsg[s.ModuleFlag].MysqlTable), entId, id)
|
|
|
-
|
|
|
- } else {
|
|
|
- IC.BaseServiceMysql.UpdateOrDeleteBySql(fmt.Sprintf("update %s set isvisit=1 where entid=? and id=?", aboutDbMsg[s.ModuleFlag].MysqlTable), entId, id)
|
|
|
-
|
|
|
- }
|
|
|
- } else {
|
|
|
- if s.ModuleFlag == EntnicheFlag {
|
|
|
- //商机管理
|
|
|
- IC.BaseServiceMysql.UpdateOrDeleteBySql(fmt.Sprintf("update %s set isvisit=1,visittime=now() where userid=? and id=?", aboutDbMsg[s.ModuleFlag].MysqlTable), entUserId, id)
|
|
|
- } else {
|
|
|
- //其他
|
|
|
- IC.BaseServiceMysql.UpdateOrDeleteBySql(fmt.Sprintf("update %s set isvisit=1 where userid=? and id=?", aboutDbMsg[s.ModuleFlag].MysqlTable), newUserId, id)
|
|
|
- }
|
|
|
+ IC.BaseServiceMysql.UpdateOrDeleteBySql(fmt.Sprintf("update %s set isvisit=1,visittime=now() where userid=? and id=?", aboutDbMsg[s.ModuleFlag].MysqlTable), common.If(s.ModuleFlag == EntnicheFlag, entUserId, newUserId), id)
|
|
|
+ if s.ModuleFlag == EntnicheFlag {
|
|
|
+ userId = entUserId
|
|
|
}
|
|
|
- if !isEnt {
|
|
|
- if s.ModuleFlag == EntnicheFlag {
|
|
|
- userId = entUserId
|
|
|
- }
|
|
|
- todaySubPush, err := s.GetTodayCache(userId, userType)
|
|
|
- //当天数据处理
|
|
|
- if err == nil && todaySubPush != nil {
|
|
|
- for _, v := range todaySubPush.Datas {
|
|
|
- if v.CaIndex == id {
|
|
|
- v.CaIsvisit = 1
|
|
|
- break
|
|
|
- }
|
|
|
+ todaySubPush, err := s.GetTodayCache(userId, userType)
|
|
|
+ //当天数据处理
|
|
|
+ if err == nil && todaySubPush != nil {
|
|
|
+ for _, v := range todaySubPush.Datas {
|
|
|
+ if v.CaIndex == id {
|
|
|
+ v.CaIsvisit = 1
|
|
|
+ break
|
|
|
}
|
|
|
- s.PutTodayCache(userId, userType, todaySubPush)
|
|
|
}
|
|
|
- //全部数据处理
|
|
|
- allSubPush, err := s.GetAllCache(userId, userType)
|
|
|
- if err == nil && allSubPush != nil {
|
|
|
- for _, v := range allSubPush.Datas {
|
|
|
- if v.CaIndex == id {
|
|
|
- v.CaIsvisit = 1
|
|
|
- break
|
|
|
- }
|
|
|
+ s.PutTodayCache(userId, userType, todaySubPush)
|
|
|
+ }
|
|
|
+ //全部数据处理
|
|
|
+ allSubPush, err := s.GetAllCache(userId, userType)
|
|
|
+ if err == nil && allSubPush != nil {
|
|
|
+ for _, v := range allSubPush.Datas {
|
|
|
+ if v.CaIndex == id {
|
|
|
+ v.CaIsvisit = 1
|
|
|
+ break
|
|
|
}
|
|
|
- s.PutAllCache(userId, userType, allSubPush)
|
|
|
}
|
|
|
+ s.PutAllCache(userId, userType, allSubPush)
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
@@ -1832,3 +1822,49 @@ func MergeArray(dest []interface{}, src []interface{}) (result []interface{}) {
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+func (s *subscribePush) ItemToKey(in *SubPushQueryParam) string {
|
|
|
+ spqp := KeyParam{
|
|
|
+ UserId: in.UserId,
|
|
|
+ EntUserId: in.EntUserId,
|
|
|
+ DeptId: in.DeptId,
|
|
|
+ NewUserId: in.NewUserId,
|
|
|
+ IsEnt: in.IsEnt,
|
|
|
+ EntId: in.EntId,
|
|
|
+ PositionType: in.PositionType,
|
|
|
+ }
|
|
|
+ //所有关键词获取
|
|
|
+ keyItemsArr := s.Keys(&spqp)
|
|
|
+ keyArr := []string{}
|
|
|
+ if len(keyItemsArr) > 0 {
|
|
|
+ for _, k1 := range keyItemsArr {
|
|
|
+ for _, k2 := range strings.Split(in.Item, ",") {
|
|
|
+ if k1.SItem == k2 {
|
|
|
+ if len(k1.AKey) > 0 {
|
|
|
+ for _, k3 := range k1.AKey {
|
|
|
+ key := ""
|
|
|
+ if len(k3.Key) > 0 {
|
|
|
+ key = strings.Join(k3.Key, " ")
|
|
|
+ }
|
|
|
+ if len(k3.Appendkey) > 0 {
|
|
|
+ if key != "" {
|
|
|
+ key += " " + strings.Join(k3.Appendkey, " ")
|
|
|
+ } else {
|
|
|
+ key = strings.Join(k3.Appendkey, " ")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if k3.Matchway == 1 {
|
|
|
+ //模糊处理
|
|
|
+ key = strings.ReplaceAll(key, " ", ",")
|
|
|
+ } else {
|
|
|
+ //精准处理
|
|
|
+ key = strings.ReplaceAll(key, " ", "+")
|
|
|
+ }
|
|
|
+ keyArr = append(keyArr, key)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return strings.Join(keyArr, ",")
|
|
|
+}
|