许愿池继承问题

This commit is contained in:
luying
2022-08-30 14:43:06 +08:00
parent 1363e0c1fa
commit b25a445d92
3 changed files with 17 additions and 12 deletions

View File

@@ -370,16 +370,23 @@ export async function settleGuildWeekly() {
export async function getWishPool(userGuild: UserGuildType) {
const { guildCode: code, wishDntCnt, wishGoods } = userGuild;
let { guildCode: code, wishDntCnt, wishGoods, receivedWishPool, refTimeDaily } = userGuild;
const now = new Date();
let isRefDaily = shouldRefresh(refTimeDaily, now);
// console.log('####### isRefDaily', isRefDaily, refTimeDaily, now)
if (isRefDaily) {
wishGoods = []; receivedWishPool = [], wishDntCnt = 0;
}
let userGuilds = await UserGuildModel.getWishPoolGoods(code, ' wishDntCnt wishGoods roleId');
let list = [];
userGuilds.map(({ wishGoods, roleId }) => {
wishGoods.map(({ type, goodId, count, receiveCnt, drawCnt, id }) => {
userGuilds.forEach(({ wishGoods, roleId }) => {
wishGoods.forEach(({ type, goodId, count, receiveCnt, drawCnt, id }) => {
list.push({ type, goodId, count, receiveCnt, drawCnt, id, roleId })
});
});
return { list, wishDntCnt: wishDntCnt || 0, wishGoods };
return { list, wishDntCnt: wishDntCnt || 0, wishGoods, receivedWishPool };
}
export function setUserGuildSession(session:FrontendOrBackendSession, myUserGuild: UserGuildType) {