task claim时, 增加判断是否有链上记录
This commit is contained in:
parent
4762663202
commit
845bb7bfd3
@ -16,6 +16,7 @@
|
|||||||
"cfg": {"icon": "twitter"},
|
"cfg": {"icon": "twitter"},
|
||||||
"start": "2024-01-01 00:00",
|
"start": "2024-01-01 00:00",
|
||||||
"end": "2025-01-01 00:00",
|
"end": "2025-01-01 00:00",
|
||||||
|
"checkChain": true,
|
||||||
"params": {}
|
"params": {}
|
||||||
}, {
|
}, {
|
||||||
"id": "e2fclylj30vwcpe0szl",
|
"id": "e2fclylj30vwcpe0szl",
|
||||||
@ -30,6 +31,7 @@
|
|||||||
"cfg": {"account": "@_CounterFire", "icon": "twitter"},
|
"cfg": {"account": "@_CounterFire", "icon": "twitter"},
|
||||||
"start": "2024-01-01 00:00",
|
"start": "2024-01-01 00:00",
|
||||||
"end": "2025-01-01 00:00",
|
"end": "2025-01-01 00:00",
|
||||||
|
"checkChain": true,
|
||||||
"params": {"time": 6, "failRate": 60}
|
"params": {"time": 6, "failRate": 60}
|
||||||
}, {
|
}, {
|
||||||
"id": "e2feyflj30vwcpe0sjy",
|
"id": "e2feyflj30vwcpe0sjy",
|
||||||
@ -44,6 +46,7 @@
|
|||||||
"cfg": {"icon": "twitter"},
|
"cfg": {"icon": "twitter"},
|
||||||
"start": "2024-01-01 00:00",
|
"start": "2024-01-01 00:00",
|
||||||
"end": "2025-01-01 00:00",
|
"end": "2025-01-01 00:00",
|
||||||
|
"checkChain": true,
|
||||||
"params": {"time": 6, "failRate": 60}
|
"params": {"time": 6, "failRate": 60}
|
||||||
}, {
|
}, {
|
||||||
"id": "e2fuah0j30vwcpe0my7",
|
"id": "e2fuah0j30vwcpe0my7",
|
||||||
@ -58,20 +61,7 @@
|
|||||||
"cfg": {"icon": "twitter", "content": "Just joined Counter Fire! 🎮 Excited about the endless opportunities ahead. 🔥 Let's team up and conquer together! Come in with me #CounterFire #GamingAdventures"},
|
"cfg": {"icon": "twitter", "content": "Just joined Counter Fire! 🎮 Excited about the endless opportunities ahead. 🔥 Let's team up and conquer together! Come in with me #CounterFire #GamingAdventures"},
|
||||||
"start": "2024-01-01 00:00",
|
"start": "2024-01-01 00:00",
|
||||||
"end": "2025-01-01 00:00",
|
"end": "2025-01-01 00:00",
|
||||||
"params": {"time": 6, "failRate": 60}
|
"checkChain": true,
|
||||||
}, {
|
|
||||||
"id": "e2fuah0j30vwcpe1my7",
|
|
||||||
"task": "TwitterRetweet",
|
|
||||||
"title": "",
|
|
||||||
"type": 1,
|
|
||||||
"desc": "Click Verify button and retweet on the tweet",
|
|
||||||
"category": "Social Tasks",
|
|
||||||
"score": 200,
|
|
||||||
"autoclaim": false,
|
|
||||||
"pretasks": ["e2yhq2lj30vwcpedv7p"],
|
|
||||||
"cfg": {"icon": "twitter", "content": "输入框自动生成,活动开始时添加内容)"},
|
|
||||||
"start": "2024-01-01 00:00",
|
|
||||||
"end": "2025-01-01 00:00",
|
|
||||||
"params": {"time": 6, "failRate": 60}
|
"params": {"time": 6, "failRate": 60}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -154,7 +154,6 @@ class BoxController extends BaseController {
|
|||||||
throw new ZError(13, 'waiting for chain confirm')
|
throw new ZError(13, 'waiting for chain confirm')
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO:: 待规则确定后, 检查用户是否符合助力条件
|
|
||||||
const chest = await ActivityChest.findOne({ shareCode: code, activity: user.activity })
|
const chest = await ActivityChest.findOne({ shareCode: code, activity: user.activity })
|
||||||
if (!chest) {
|
if (!chest) {
|
||||||
throw new ZError(12, 'chest not found')
|
throw new ZError(12, 'chest not found')
|
||||||
|
@ -317,7 +317,11 @@ class GameController extends BaseController {
|
|||||||
if (!isObjectId(id)) {
|
if (!isObjectId(id)) {
|
||||||
throw new ZError(12, 'invalid id')
|
throw new ZError(12, 'invalid id')
|
||||||
}
|
}
|
||||||
const chainRecord = await GeneralScription.findOne({ from: user.address.toLowerCase(), op: 'explore', data: id })
|
const chainRecord = await GeneralScription.findOne({
|
||||||
|
from: user.address.toLowerCase(),
|
||||||
|
op: 'explore',
|
||||||
|
data: id,
|
||||||
|
})
|
||||||
if (!chainRecord) {
|
if (!chainRecord) {
|
||||||
throw new ZError(13, 'waiting for chain confirm')
|
throw new ZError(13, 'waiting for chain confirm')
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import { TaskCfg, TaskTypeEnum } from 'models/ActivityInfo'
|
|||||||
import { TaskStatus, TaskStatusEnum } from 'models/ActivityUser'
|
import { TaskStatus, TaskStatusEnum } from 'models/ActivityUser'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { formatDate } from 'zutils/utils/date.util'
|
import { formatDate } from 'zutils/utils/date.util'
|
||||||
|
import { GeneralScription } from 'models/chain/GeneralScription'
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
|
|
||||||
const prod = process.env.NODE_ENV === 'production'
|
const prod = process.env.NODE_ENV === 'production'
|
||||||
@ -191,6 +192,16 @@ export default class TasksController extends BaseController {
|
|||||||
if (currentTask.status !== TaskStatusEnum.SUCCESS && currentTask.status !== TaskStatusEnum.PART_SUCCESS) {
|
if (currentTask.status !== TaskStatusEnum.SUCCESS && currentTask.status !== TaskStatusEnum.PART_SUCCESS) {
|
||||||
throw new ZError(13, 'task not end')
|
throw new ZError(13, 'task not end')
|
||||||
}
|
}
|
||||||
|
if (cfg.checkChain) {
|
||||||
|
const chainRecord = await GeneralScription.findOne({
|
||||||
|
from: user.address.toLowerCase(),
|
||||||
|
op: 'task_claim',
|
||||||
|
data: task,
|
||||||
|
})
|
||||||
|
if (!chainRecord) {
|
||||||
|
throw new ZError(14, 'waiting for chain confirm')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const Task = require('../tasks/' + currentTask.task)
|
const Task = require('../tasks/' + currentTask.task)
|
||||||
const taskInstance = new Task.default({ user, activity })
|
const taskInstance = new Task.default({ user, activity })
|
||||||
|
@ -39,6 +39,8 @@ export class TaskCfg {
|
|||||||
end?: string
|
end?: string
|
||||||
@prop({ type: mongoose.Schema.Types.Mixed })
|
@prop({ type: mongoose.Schema.Types.Mixed })
|
||||||
params: any
|
params: any
|
||||||
|
@prop({ default: true })
|
||||||
|
checkChain: boolean
|
||||||
|
|
||||||
public isStart() {
|
public isStart() {
|
||||||
const now = Date.now()
|
const now = Date.now()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user