|
@@ -178,18 +178,16 @@ func (s *subscribePush) Datas(MQFW mg.MongodbSim, PushMysql *mysql.Mysql, userId
|
|
|
if err != nil {
|
|
|
log.Println(userId, "GetAllCache Error", err)
|
|
|
}
|
|
|
- if err == nil && allCache != nil && len(allCache) > 0 {
|
|
|
- result = allCache
|
|
|
- } else {
|
|
|
- result = s.getDatasFromMysql(MQFW, PushMysql, userId, 1, AllSubPushCacheSize, selectTime, area, true)
|
|
|
- SubscribePush.PutAllCache(userId, result)
|
|
|
+ if err != nil || allCache == nil || len(allCache) == 0 {
|
|
|
+ allCache = s.getDatasFromMysql(MQFW, PushMysql, userId, 1, AllSubPushCacheSize, selectTime, area, true)
|
|
|
+ SubscribePush.PutAllCache(userId, allCache)
|
|
|
}
|
|
|
- length := len(result)
|
|
|
+ length := len(allCache)
|
|
|
if end > length {
|
|
|
end = length
|
|
|
}
|
|
|
if start < length {
|
|
|
- result = result[start:end]
|
|
|
+ result = allCache[start:end]
|
|
|
}
|
|
|
} else {
|
|
|
result = s.getDatasFromMysql(MQFW, PushMysql, userId, pageNum, pageSize, selectTime, area, true)
|