Skip to content

Commit

Permalink
fix: 修正WorldBossController中的lodash引入問題
Browse files Browse the repository at this point in the history
修正WorldBossController中的lodash引入問題,將get函式改為isNull函式來處理totalCost的判斷,避免出現undefined的情況。
  • Loading branch information
hanshino committed Sep 7, 2024
1 parent ff9c9b1 commit 110fe5d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/src/controller/application/WorldBossController.js
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ async function isUserCanAttack(userId) {

// 取得今日紀錄
const result = await worldBossEventLogService.getTodayCost(userId);
const totalCost = parseInt(get(result, "totalCost", 0));
const totalCost = isNull(result.totalCost) ? 0 : parseInt(result.totalCost);
// 如果完全沒有紀錄,代表可以攻擊
if (totalCost === 0) {
await redis.set(key, 1, {
Expand Down

0 comments on commit 110fe5d

Please sign in to comment.