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

This commit is contained in:
luying
2022-05-13 19:29:31 +08:00
parent 2498d58da5
commit 205ad897d9
+11 -12
View File
@@ -333,23 +333,22 @@ export class CheckSingleTask {
switch(this.taskType) { switch(this.taskType) {
case TASK_TYPE.LOGIN_SUM: // 1. 累计登录 x 天 case TASK_TYPE.LOGIN_SUM: // 1. 累计登录 x 天
{ {
let role = this.getRole(); let records = await getRecord();
let today = getZeroPoint(); let today = `${getZeroPoint()}`;
if (today > role.loginTime) { if (records.indexOf(today) == -1) {
result = { inc: 1 } result = { inc: 1, records: [...records, today] }
} }
break; break;
} }
case TASK_TYPE.LOGIN_SERIES: // 2. 连续登录 x 天 case TASK_TYPE.LOGIN_SERIES: // 2. 连续登录 x 天
{ {
let role = this.getRole(); let records = await getRecord();
let today = getZeroPoint(); let today = `${getZeroPoint()}`;
if (today > role.loginTime) { let yesterday = `${getZeroPoint() - 24 * 60 * 60}`
if (today - role.loginTime > 24 * 60 * 60) { if (records.indexOf(yesterday) == -1) {
result = { set: 1 } result = { set: 1, records: [...records, today] }
} else { } else {
result = { inc: 1 } result = { inc: 1, records: [...records, today] }
}
} }
break; break;
} }