任务:修改每日登录任务逻辑

This commit is contained in:
luying
2022-05-13 19:29:31 +08:00
parent 2498d58da5
commit 205ad897d9

View File

@@ -333,23 +333,22 @@ export class CheckSingleTask {
switch(this.taskType) {
case TASK_TYPE.LOGIN_SUM: // 1. 累计登录 x 天
{
let role = this.getRole();
let today = getZeroPoint();
if (today > role.loginTime) {
result = { inc: 1 }
let records = await getRecord();
let today = `${getZeroPoint()}`;
if (records.indexOf(today) == -1) {
result = { inc: 1, records: [...records, today] }
}
break;
}
case TASK_TYPE.LOGIN_SERIES: // 2. 连续登录 x 天
{
let role = this.getRole();
let today = getZeroPoint();
if (today > role.loginTime) {
if (today - role.loginTime > 24 * 60 * 60) {
result = { set: 1 }
} else {
result = { inc: 1 }
}
let records = await getRecord();
let today = `${getZeroPoint()}`;
let yesterday = `${getZeroPoint() - 24 * 60 * 60}`
if (records.indexOf(yesterday) == -1) {
result = { set: 1, records: [...records, today] }
} else {
result = { inc: 1, records: [...records, today] }
}
break;
}