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