fix some bug
This commit is contained in:
parent
e9b0f802c1
commit
2b5ae26454
@ -8,27 +8,30 @@
|
||||
"title": "Connect Twitter",
|
||||
"type": 1,
|
||||
"desc": "",
|
||||
"score": 100,
|
||||
"category": "",
|
||||
"autoclaim": true,
|
||||
"params": {"score": 100}
|
||||
"params": {}
|
||||
}, {
|
||||
"id": "TwitterFollow",
|
||||
"title": "Follow Twitter",
|
||||
"type": 1,
|
||||
"desc": "",
|
||||
"category": "",
|
||||
"score": 100,
|
||||
"autoclaim": false,
|
||||
"pretasks": ["TwitterConnect"],
|
||||
"params": {"score": 100, "time": 6, "failRate": 60}
|
||||
"params": {"time": 6, "failRate": 60}
|
||||
}, {
|
||||
"id": "TwitterRetweet",
|
||||
"title": "ReTwitt",
|
||||
"type": 2,
|
||||
"desc": "",
|
||||
"category": "",
|
||||
"score": 100,
|
||||
"autoclaim": false,
|
||||
"pretasks": ["TwitterConnect"],
|
||||
"params": {"score": 100, "time": 6, "failRate": 60}
|
||||
"params": {"time": 6, "failRate": 60}
|
||||
}, {
|
||||
"id": "UpdateScore",
|
||||
"type": 1,
|
||||
|
@ -76,7 +76,7 @@ export default class TasksController extends BaseController {
|
||||
let { task } = req.params;
|
||||
const [taskId, dateTag] = task.split(':');
|
||||
const currentDateTag = formatDate(new Date());
|
||||
if (currentDateTag !== dateTag) {
|
||||
if (dateTag && currentDateTag !== dateTag) {
|
||||
throw new ZError(11, 'task date not match')
|
||||
}
|
||||
let cfg = activity.tasks.find((t: TaskCfg) => t.id === taskId);
|
||||
@ -118,7 +118,7 @@ export default class TasksController extends BaseController {
|
||||
const { task } = req.params;
|
||||
const [taskId, dateTag] = task.split(':');
|
||||
const currentDateTag = formatDate(new Date());
|
||||
if (currentDateTag !== dateTag) {
|
||||
if (dateTag && currentDateTag !== dateTag) {
|
||||
throw new ZError(11, 'task date not match')
|
||||
}
|
||||
let currentTask = user.taskProgress.find((t: TaskStatus) => t.id === task);
|
||||
|
@ -18,6 +18,9 @@ export abstract class ITask {
|
||||
const user = this.params.user
|
||||
const [taskId, dateTag] = task.id.split(':');
|
||||
const cfg = this.params.activity.tasks.find((t: TaskCfg) => t.id === taskId)
|
||||
if (!cfg.score) {
|
||||
return;
|
||||
}
|
||||
await updateRankScore({
|
||||
user: user.id,
|
||||
score: cfg.score,
|
||||
|
@ -1,7 +1,7 @@
|
||||
// format the date to the format we want
|
||||
export const formatDate = (date: Date): string => {
|
||||
const year = date.getFullYear();
|
||||
const month = date.getMonth() + 1;
|
||||
const day = date.getDate();
|
||||
const month = (date.getMonth() + 1 + '').padStart(2, '0');
|
||||
const day = (date.getDate() + '').padStart(2, '0');
|
||||
return `${year}${month}${day}`;
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user