奖励已经双倍奖励
This commit is contained in:
@@ -15,20 +15,20 @@ async function getFightHeros(db, openid) {
|
||||
if (!user) {
|
||||
return {
|
||||
code: -4,
|
||||
msg: "User not found"
|
||||
msg: "未找到用户"
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
code: 200,
|
||||
data: user.fight_heros,
|
||||
msg: "Fight heros retrieved successfully"
|
||||
msg: "出战英雄获取成功"
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Get fight heros error:", error);
|
||||
console.error("获取出战英雄错误:", error);
|
||||
return {
|
||||
code: -5,
|
||||
msg: `Get fight heros error: ${error.message}`
|
||||
msg: `获取出战英雄错误: ${error.message}`
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ async function setFightHero(db, openid, position, heroId) {
|
||||
if (!user) {
|
||||
return {
|
||||
code: -4,
|
||||
msg: "User not found"
|
||||
msg: "未找到用户"
|
||||
};
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ async function setFightHero(db, openid, position, heroId) {
|
||||
if (position < 0 || position > 4) {
|
||||
return {
|
||||
code: -3,
|
||||
msg: "Invalid position, must be 0-4"
|
||||
msg: "无效的位置,必须是0-4"
|
||||
};
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ async function setFightHero(db, openid, position, heroId) {
|
||||
if (typeof heroId !== 'number' || heroId < 0) {
|
||||
return {
|
||||
code: -3,
|
||||
msg: "Invalid hero ID"
|
||||
msg: "无效的英雄ID"
|
||||
};
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ async function setFightHero(db, openid, position, heroId) {
|
||||
if (heroId > 0 && !user.heros[heroId]) {
|
||||
return {
|
||||
code: -6,
|
||||
msg: "Hero not owned"
|
||||
msg: "未拥有该英雄"
|
||||
};
|
||||
}
|
||||
|
||||
@@ -93,19 +93,19 @@ async function setFightHero(db, openid, position, heroId) {
|
||||
old_hero_id: oldHeroId,
|
||||
new_hero_id: heroId
|
||||
},
|
||||
msg: `Fight hero position ${position} updated successfully`
|
||||
msg: `出战英雄位置 ${position} 更新成功`
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
code: -1,
|
||||
msg: `Set fight hero fail`
|
||||
msg: `设置出战英雄失败`
|
||||
};
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Set fight hero error:", error);
|
||||
console.error("设置出战英雄错误:", error);
|
||||
return {
|
||||
code: -5,
|
||||
msg: `Set fight hero error: ${error.message}`
|
||||
msg: `设置出战英雄错误: ${error.message}`
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@ async function updateFightHeros(db, openid, fightHeros) {
|
||||
if (!user) {
|
||||
return {
|
||||
code: -4,
|
||||
msg: "User not found"
|
||||
msg: "未找到用户"
|
||||
};
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ async function updateFightHeros(db, openid, fightHeros) {
|
||||
if (!fightHeros || typeof fightHeros !== 'object') {
|
||||
return {
|
||||
code: -3,
|
||||
msg: "Invalid fight heros data format"
|
||||
msg: "无效的出战英雄数据格式"
|
||||
};
|
||||
}
|
||||
|
||||
@@ -144,14 +144,14 @@ async function updateFightHeros(db, openid, fightHeros) {
|
||||
if (isNaN(position) || position < 0 || position > 4) {
|
||||
return {
|
||||
code: -3,
|
||||
msg: `Invalid position: ${pos}`
|
||||
msg: `无效的位置: ${pos}`
|
||||
};
|
||||
}
|
||||
|
||||
if (typeof heroId !== 'number' || heroId < 0) {
|
||||
return {
|
||||
code: -3,
|
||||
msg: `Invalid hero ID for position ${pos}: ${heroId}`
|
||||
msg: `位置 ${pos} 的英雄ID无效: ${heroId}`
|
||||
};
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ async function updateFightHeros(db, openid, fightHeros) {
|
||||
if (heroId > 0 && !user.heros[heroId]) {
|
||||
return {
|
||||
code: -6,
|
||||
msg: `Hero ${heroId} not owned for position ${pos}`
|
||||
msg: `位置 ${pos} 未拥有英雄 ${heroId}`
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -177,19 +177,19 @@ async function updateFightHeros(db, openid, fightHeros) {
|
||||
return {
|
||||
code: 200,
|
||||
data: newFightHeros,
|
||||
msg: "Fight heros updated successfully"
|
||||
msg: "出战英雄更新成功"
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
code: -1,
|
||||
msg: `Update fight heros fail`
|
||||
msg: `更新出战英雄失败`
|
||||
};
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Update fight heros error:", error);
|
||||
console.error("更新出战英雄错误:", error);
|
||||
return {
|
||||
code: -5,
|
||||
msg: `Update fight heros error: ${error.message}`
|
||||
msg: `更新出战英雄错误: ${error.message}`
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -206,7 +206,7 @@ async function getActiveFightHeros(db, openid) {
|
||||
if (!user) {
|
||||
return {
|
||||
code: -4,
|
||||
msg: "User not found"
|
||||
msg: "未找到用户"
|
||||
};
|
||||
}
|
||||
|
||||
@@ -228,13 +228,13 @@ async function getActiveFightHeros(db, openid) {
|
||||
active_heros: activeHeros,
|
||||
total_count: activeHeros.length
|
||||
},
|
||||
msg: "Active fight heros retrieved successfully"
|
||||
msg: "获取活跃出战英雄成功"
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Get active fight heros error:", error);
|
||||
console.error("获取活跃出战英雄错误:", error);
|
||||
return {
|
||||
code: -5,
|
||||
msg: `Get active fight heros error: ${error.message}`
|
||||
msg: `获取活跃出战英雄错误: ${error.message}`
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -254,7 +254,7 @@ async function swapFightHeros(db, openid, position1, position2) {
|
||||
if (!user) {
|
||||
return {
|
||||
code: -4,
|
||||
msg: "User not found"
|
||||
msg: "未找到用户"
|
||||
};
|
||||
}
|
||||
|
||||
@@ -262,14 +262,14 @@ async function swapFightHeros(db, openid, position1, position2) {
|
||||
if (position1 < 0 || position1 > 4 || position2 < 0 || position2 > 4) {
|
||||
return {
|
||||
code: -3,
|
||||
msg: "Invalid positions, must be 0-4"
|
||||
msg: "无效的位置,必须是0-4"
|
||||
};
|
||||
}
|
||||
|
||||
if (position1 === position2) {
|
||||
return {
|
||||
code: -3,
|
||||
msg: "Cannot swap same position"
|
||||
msg: "不能交换相同位置"
|
||||
};
|
||||
}
|
||||
|
||||
@@ -293,19 +293,19 @@ async function swapFightHeros(db, openid, position1, position2) {
|
||||
hero1_moved_to: hero1,
|
||||
hero2_moved_to: hero2
|
||||
},
|
||||
msg: `Fight heros swapped successfully`
|
||||
msg: `出战英雄交换成功`
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
code: -1,
|
||||
msg: `Swap fight heros fail`
|
||||
msg: `交换出战英雄失败`
|
||||
};
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Swap fight heros error:", error);
|
||||
console.error("交换出战英雄错误:", error);
|
||||
return {
|
||||
code: -5,
|
||||
msg: `Swap fight heros error: ${error.message}`
|
||||
msg: `交换出战英雄错误: ${error.message}`
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -324,7 +324,7 @@ async function resetFightHeros(db, openid) {
|
||||
if (!user) {
|
||||
return {
|
||||
code: -4,
|
||||
msg: "User not found"
|
||||
msg: "未找到用户"
|
||||
};
|
||||
}
|
||||
|
||||
@@ -342,19 +342,19 @@ async function resetFightHeros(db, openid) {
|
||||
return {
|
||||
code: 200,
|
||||
data: defaultData.fight_heros,
|
||||
msg: "Fight heros reset successfully"
|
||||
msg: "出战英雄重置成功"
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
code: -1,
|
||||
msg: `Reset fail, ${JSON.stringify(resetRes)}`
|
||||
msg: `重置失败, ${JSON.stringify(resetRes)}`
|
||||
};
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Reset fight heros error:", error);
|
||||
console.error("重置出战英雄错误:", error);
|
||||
return {
|
||||
code: -5,
|
||||
msg: `Reset fight heros error: ${error.message}`
|
||||
msg: `重置出战英雄错误: ${error.message}`
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user