🐞 fix(巅峰演武): 当没有pvp数据时,登录也还是下发

This commit is contained in:
luying
2022-10-19 14:27:15 +08:00
parent 13650db78f
commit 83d1384794
+7 -4
View File
@@ -256,14 +256,15 @@ async function getTowerEntryData(role: RoleType) {
* @param roleId * @param roleId
*/ */
async function getPvpEntryData(roleId: string) { async function getPvpEntryData(roleId: string) {
let pvpDefense = await PvpDefenseModel.findByRoleId(roleId);
if (pvpDefense) {
pvpDefense = await sendLastSeasonRewardIfNotSent(pvpDefense);
let seasonNum: number = pinus.app.get('pvpSeasonNum'); let seasonNum: number = pinus.app.get('pvpSeasonNum');
let seasonEndTime: number = pinus.app.get('pvpSeasonEndTime'); let seasonEndTime: number = pinus.app.get('pvpSeasonEndTime');
let seasonStartTime: number = pinus.app.get('pvpSeasonStartTime'); let seasonStartTime: number = pinus.app.get('pvpSeasonStartTime');
let seasonRewardTime: number = pinus.app.get('pvpSeasonRewardTime'); let seasonRewardTime: number = pinus.app.get('pvpSeasonRewardTime');
let pvpDefense = await PvpDefenseModel.findByRoleId(roleId);
if (pvpDefense) {
pvpDefense = await sendLastSeasonRewardIfNotSent(pvpDefense);
let result = new PvpDataReturn(); // 返回对象 let result = new PvpDataReturn(); // 返回对象
result.setPvpConfig(seasonNum, seasonStartTime, seasonEndTime, seasonRewardTime); result.setPvpConfig(seasonNum, seasonStartTime, seasonEndTime, seasonRewardTime);
result.setPvpDefense(pvpDefense); result.setPvpDefense(pvpDefense);
@@ -273,7 +274,9 @@ async function getPvpEntryData(roleId: string) {
result.setChallengeCnt(challengeCnt); result.setChallengeCnt(challengeCnt);
return pick(result, ['challengeCnt', 'score', 'seasonWinNum', 'receivedBox', 'hasSaveDefense', 'seasonNum', 'seasonEndTime', 'seasonStartTime', 'seasonRewardTime']) return pick(result, ['challengeCnt', 'score', 'seasonWinNum', 'receivedBox', 'hasSaveDefense', 'seasonNum', 'seasonEndTime', 'seasonStartTime', 'seasonRewardTime'])
} else { } else {
return null let result = new PvpDataReturn(); // 返回对象
result.setPvpConfig(seasonNum, seasonStartTime, seasonEndTime, seasonRewardTime);
return pick(result, ['seasonNum', 'seasonEndTime', 'seasonStartTime', 'seasonRewardTime'])
} }
} }