fix 消息翻页后数据减少问题

This commit is contained in:
jxxghp
2023-10-17 19:59:31 +08:00
parent f15ccadc2d
commit 4cc2551487

View File

@ -1,3 +1,4 @@
import copy
from typing import Any from typing import Any
from app.chain.download import * from app.chain.download import *
@ -204,10 +205,11 @@ class MessageChain(ChainBase):
self.post_message(Notification( self.post_message(Notification(
channel=channel, title="已经是第一页了!", userid=userid)) channel=channel, title="已经是第一页了!", userid=userid))
return return
cache_type: str = cache_data.get('type')
cache_list: list = cache_data.get('items')
# 减一页 # 减一页
_current_page -= 1 _current_page -= 1
cache_type: str = cache_data.get('type')
# 产生副本,避免修改原值
cache_list: list = copy.deepcopy(cache_data.get('items'))
if _current_page == 0: if _current_page == 0:
start = 0 start = 0
end = self._page_size end = self._page_size
@ -243,7 +245,8 @@ class MessageChain(ChainBase):
channel=channel, title="输入有误!", userid=userid)) channel=channel, title="输入有误!", userid=userid))
return return
cache_type: str = cache_data.get('type') cache_type: str = cache_data.get('type')
cache_list: list = cache_data.get('items') # 产生副本,避免修改原值
cache_list: list = copy.deepcopy(cache_data.get('items'))
total = len(cache_list) total = len(cache_list)
# 加一页 # 加一页
cache_list = cache_list[ cache_list = cache_list[