测试:修复聊天可能查询不到chatinfo
This commit is contained in:
@@ -252,7 +252,8 @@ function createChatRec(sender: boolean, curTime: Date, targetRoleId) {
|
||||
* @param {Date} curTime
|
||||
*/
|
||||
async function updateRecentChats(sender: boolean, roleId: string, targetRoleId: string, curTime: Date) {
|
||||
const { recentPrivateChats } = await ChatInfoModel.findInfo(roleId);
|
||||
const chatInfo = await ChatInfoModel.findInfo(roleId);
|
||||
let recentPrivateChats = chatInfo?.recentPrivateChats||[];
|
||||
const recIdx = recentPrivateChats.findIndex(chat => { return chat.targetRoleId === targetRoleId });
|
||||
if (recIdx === -1) {
|
||||
recentPrivateChats.push(createChatRec(sender, curTime, targetRoleId));
|
||||
|
||||
Reference in New Issue
Block a user