测试:修改任务好友军团活动

This commit is contained in:
luying
2022-04-06 12:39:54 +08:00
parent 4397b03bdf
commit 126c51b4dd
9 changed files with 18 additions and 35 deletions
+6 -2
View File
@@ -251,7 +251,7 @@ function createChatRec(sender: boolean, curTime: Date, targetRoleId) {
* @param {Date} curTime
*/
async function updateRecentChats(sender: boolean, roleId: string, targetRoleId: string, curTime: Date) {
const chatInfo = await ChatInfoModel.findInfo(roleId);
const chatInfo = await roleChatInfos(roleId);
let recentPrivateChats: PrivateChatRec[] = chatInfo?.recentPrivateChats||[]
const recIdx = recentPrivateChats.findIndex(chat => { return chat.targetRoleId === targetRoleId });
if (recIdx === -1) {
@@ -269,7 +269,11 @@ async function updateRecentChats(sender: boolean, roleId: string, targetRoleId:
/**
* @description 获取聊天信息
*/
export async function roleChatInfos(roleId: string, roleName: string) {
export async function roleChatInfos(roleId: string, roleName?: string) {
if(!roleName) {
let role = await RoleModel.findByRoleId(roleId, 'roleName');
roleName = role.roleName;
}
let result = await ChatInfoModel.findInfo(roleId);
if (!result) {
result = await ChatInfoModel.createInfo({ roleId, roleName });