修复任务添加配置后不会自动生成后续任务
This commit is contained in:
xichaoyin 2024-01-08 18:19:51 +08:00
parent d91c413603
commit 0c26c6d5bb

View File

@ -4,6 +4,7 @@ import {taskType} from "../shared/protocols/task/type";
import { PublicShared } from "../shared/public/public";
import { PeijianFun } from "./peijian";
import { manager } from "./taskclass";
import ApiRecTask from "../api_s2c/event/zhanling/ApiRecTask";
let taskDict = {};
const SHUJUKU = "task";
@ -260,6 +261,28 @@ export class TaskFun {
delete _w["finish"];
}
let _tmp = await this.getUserTaksList(call.uid, _w);
// 没有未完成任务
// 检测是否有新加任务
if (_tmp.length == 0) {
let rectask = (await G.mongodb.collection('task').find(
{ uid: call.uid, type: _type }, { projection: { taskid: 1, _id: 0 } }
).toArray()).map(e => e.taskid);
for (let taskid of rectask) {
let conf = G.gc.task[_type][taskid];
// 配置不存在
// 没有后续任务
// 后续任务已完成
if (!conf || !conf.followtask || rectask.includes(conf.followtask)) {
continue
}
// 生成后续任务
await this.setTaskInfo(call, conf.followtask, { type: _type });
break;
}
_tmp = await this.getUserTaksList(call.uid, _w);
}
_r[_type] = _tmp;
}
return _r;