|
@@ -820,8 +820,11 @@ func (s *subscribePush) DefaultDatas(spqp *SubPushQueryParam) (hasNextPage bool,
|
|
|
func (s *subscribePush) listManager(spqp *SubPushQueryParam, list []map[string]interface{}, keyword []ViewKeyWord) (resultList []*bxsubscribe.SubscribeInfo) {
|
|
|
t2 := time.Now()
|
|
|
now := time.Now()
|
|
|
- var pushInsert = []interface{}{}
|
|
|
- for _, v := range list {
|
|
|
+ length := len(list)
|
|
|
+ resultList := make([]*bxsubscribe.SubscribeInfo, length)
|
|
|
+ pushInsert := []interface{}{}
|
|
|
+ for i := length - 1; i >= 0; i-- {
|
|
|
+ v := list[i]
|
|
|
title := strings.Replace(common.ObjToString(v["title"]), "\n", "", -1)
|
|
|
infoid := common.InterfaceToStr(v["_id"])
|
|
|
matchkeys := getKeys(title, keyword)
|
|
@@ -841,12 +844,12 @@ func (s *subscribePush) listManager(spqp *SubPushQueryParam, list []map[string]i
|
|
|
pushInsert = append(pushInsert, common.InterfaceToStr(spqp.NewUserId), common.InterfaceToStr(infoid), matchkey, now, 0)
|
|
|
}
|
|
|
redis.Put("pushcache_2_a", redisKey, 1, 86400)
|
|
|
- resultList = append(resultList, s.InfoFormat(&PushCa{
|
|
|
+ resultList[i] = s.InfoFormat(&PushCa{
|
|
|
InfoId: infoid,
|
|
|
Date: time.Now().Unix(),
|
|
|
Keys: matchkeys,
|
|
|
FileExists: v["filetext"] != nil,
|
|
|
- }, &v))
|
|
|
+ }, &v)
|
|
|
}
|
|
|
id := int64(0)
|
|
|
switch s.ModuleFlag {
|
|
@@ -857,7 +860,7 @@ func (s *subscribePush) listManager(spqp *SubPushQueryParam, list []map[string]i
|
|
|
default:
|
|
|
_, id = spqp.BaseServiceMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, subscribeInsertCollKey, pushInsert)
|
|
|
}
|
|
|
- for i := 0; i < len(resultList); i++ {
|
|
|
+ for i := length - 1; i >= 0; i-- {
|
|
|
resultList[i].CaIndex = id
|
|
|
id++
|
|
|
}
|