🐞 fix(guild): 修复军团退出重进数据重置问题
This commit is contained in:
@@ -29,6 +29,7 @@ import { BattleRecordModel } from "../db/BattleRecord";
|
||||
import { BossInstanceModel } from "../db/BossInstance";
|
||||
import { pick } from "underscore";
|
||||
import { memberJoinGuildToLeague } from "./gvg/gvgTeamService";
|
||||
import { isToday } from '../pubUtils/timeUtil';
|
||||
|
||||
export async function getMyGuildInfo(roleId: string, sid: string, userGuild: UserGuildType, guild: GuildType, serverId: number, session: FrontendOrBackendSession) {
|
||||
|
||||
@@ -141,7 +142,10 @@ export async function joinGuild(code: string, guildName: string, lv: number, rol
|
||||
}
|
||||
|
||||
//成长任务-加入军团
|
||||
await checkTask(serverId, roleId, sid, TASK_TYPE.GUILD_JOIN);
|
||||
if (!isToday(role.quitGuildTime)) {
|
||||
// 离开军团 和 加入进团 不是同一天,才新建初始化任务(包含首次加入)
|
||||
await checkTask(serverId, roleId, sid, TASK_TYPE.GUILD_JOIN);
|
||||
}
|
||||
|
||||
return { status: 0, guild, userGuild, roleName: role.roleName, memberCnt: guild.memberCnt, guildCe: guild.guildCe }
|
||||
}
|
||||
@@ -234,6 +238,32 @@ export async function getUserGuildWithRefActive(roleId: string, select?: string)
|
||||
return userGuild;
|
||||
}
|
||||
|
||||
/**
|
||||
* 今天在军团中是否能许愿
|
||||
*
|
||||
* @export
|
||||
* @param {string} roleId
|
||||
*/
|
||||
export async function canWishToday(roleId: string): Promise<Boolean> {
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
if (!role) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let userGuild = await UserGuildModel.findMyLastGuild(roleId, ' wishGoods');
|
||||
if (!userGuild) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 今天退出过军团 & 在退出的军团许过愿
|
||||
if (isToday(role.quitGuildTime) && (userGuild.wishGoods && userGuild.wishGoods.length > 0)) {
|
||||
// 新加入的军团不允许许愿
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
async function sendUnreceivedWishPool(wishGoods: WishGood[], roleId: string) {
|
||||
wishGoods.map(async function ({ donateNames, goodId, drawCnt }) {
|
||||
let goodInfo = getGoodById(goodId)
|
||||
|
||||
Reference in New Issue
Block a user