wcj 5 年之前
父節點
當前提交
cd4162c7a6
共有 1 個文件被更改,包括 5 次插入7 次删除
  1. 5 7
      common/src/qfw/util/jy/subscribepush.go

+ 5 - 7
common/src/qfw/util/jy/subscribepush.go

@@ -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)