parent
28e4aca1f2
commit
e57fad35d8
@ -1,17 +1,15 @@
|
||||
import {ApiCall} from "tsrpc";
|
||||
import {PlayerFun} from '../../public/player';
|
||||
import {XstaskFun} from '../../public/xstask';
|
||||
import {ReqAllGet, ResAllGet} from "../../shared/protocols/xstask/PtlAllGet";
|
||||
import {HongDianChange} from "../hongdian/fun";
|
||||
import {PublicShared} from "../../shared/public/public";
|
||||
import {TeQuanFun} from "../../public/tequan";
|
||||
import { ApiCall } from "tsrpc";
|
||||
import { PlayerFun } from '../../public/player';
|
||||
import { XstaskFun } from '../../public/xstask';
|
||||
import { ReqAllGet, ResAllGet } from "../../shared/protocols/xstask/PtlAllGet";
|
||||
import { HongDianChange } from "../hongdian/fun";
|
||||
import { PublicShared } from "../../shared/public/public";
|
||||
|
||||
export default async function (call: ApiCall<ReqAllGet, ResAllGet>) {
|
||||
const taskList = JSON.parse(JSON.stringify(await XstaskFun.getAllTask(call.uid)));
|
||||
let taskInfo = await XstaskFun.getInfo(call.uid);
|
||||
let tequan = await TeQuanFun.getXsTaskNum(call);
|
||||
let prizeArr: atn[] = []
|
||||
for (let task of taskList) {
|
||||
let prizeArr:atn[] = []
|
||||
for(let task of taskList) {
|
||||
const taskConf = G.gc.xstask[task?.taskId];
|
||||
if (!task) continue;
|
||||
if (task.receiveData == undefined) continue;
|
||||
@ -25,12 +23,12 @@ export default async function (call: ApiCall<ReqAllGet, ResAllGet>) {
|
||||
// }
|
||||
continue
|
||||
}
|
||||
let change: Parameters<typeof XstaskFun.changeInfo>[1] = {$inc: {}};
|
||||
let change: Parameters<typeof XstaskFun.changeInfo>[1] = { $inc: {} };
|
||||
change.$inc[`finishNum.${taskConf.colour}`] = 1;
|
||||
// 比对派遣时间,如果小于当日0点,则更新新任务,否则该变领取状态为true
|
||||
if (task.receiveData.time < PublicShared.getToDayZeroTime()) {
|
||||
if(task.receiveData.time < PublicShared.getToDayZeroTime()) {
|
||||
// 更新任务
|
||||
let newTask = XstaskFun.randomTasks(taskInfo?.lv, 1)
|
||||
let newTask = XstaskFun.randomTasks(taskInfo?.lv, 1)
|
||||
XstaskFun.updateTask(call.uid, task._id, newTask[0].taskId)
|
||||
} else {
|
||||
// 更新领取状态
|
||||
@ -40,14 +38,6 @@ export default async function (call: ApiCall<ReqAllGet, ResAllGet>) {
|
||||
XstaskFun.changeInfo(call.uid, change);
|
||||
await PlayerFun.sendPrize(call, taskConf.prize);
|
||||
HongDianChange.sendChangeKey(call.uid, ['xstaskhd', 'huodonghd']);
|
||||
|
||||
if (!tequan) {
|
||||
prizeArr.push(...taskConf.prize)
|
||||
} else {
|
||||
for (let i = 0; i < 3; i++) {
|
||||
prizeArr.push(...taskConf.prize)
|
||||
}
|
||||
}
|
||||
prizeArr.push(...taskConf.prize)
|
||||
}
|
||||
call.succ({
|
||||
|
@ -1,10 +1,9 @@
|
||||
import {ApiCall} from "tsrpc";
|
||||
import {PlayerFun} from '../../public/player';
|
||||
import {XstaskFun} from '../../public/xstask';
|
||||
import {ReqGet, ResGet} from "../../shared/protocols/xstask/PtlGet";
|
||||
import {HongDianChange} from "../hongdian/fun";
|
||||
import {PublicShared} from '../../shared/public/public';
|
||||
import {TeQuanFun} from "../../public/tequan";
|
||||
import { ApiCall } from "tsrpc";
|
||||
import { PlayerFun } from '../../public/player';
|
||||
import { XstaskFun } from '../../public/xstask';
|
||||
import { ReqGet, ResGet } from "../../shared/protocols/xstask/PtlGet";
|
||||
import { HongDianChange } from "../hongdian/fun";
|
||||
import { PublicShared } from '../../shared/public/public';
|
||||
|
||||
export default async function (call: ApiCall<ReqGet, ResGet>) {
|
||||
|
||||
@ -24,32 +23,24 @@ export default async function (call: ApiCall<ReqGet, ResGet>) {
|
||||
}
|
||||
}
|
||||
|
||||
let change: Parameters<typeof XstaskFun.changeInfo>[1] = {$inc: {}};
|
||||
let change: Parameters<typeof XstaskFun.changeInfo>[1] = { $inc: {} };
|
||||
change.$inc[`finishNum.${taskConf.colour}`] = 1;
|
||||
// 比对派遣时间,如果小于当日0点,则更新新任务,否则该变领取状态为true
|
||||
if (task.receiveData.time < PublicShared.getToDayZeroTime()) {
|
||||
if(task.receiveData.time < PublicShared.getToDayZeroTime()) {
|
||||
// 更新任务
|
||||
let newTask = XstaskFun.randomTasks(taskInfo?.lv, 1)
|
||||
let newTask = XstaskFun.randomTasks(taskInfo?.lv, 1)
|
||||
XstaskFun.updateTask(call.uid, call.req._id, newTask[0].taskId)
|
||||
} else {
|
||||
// 更新领取状态
|
||||
XstaskFun.finishTask(call.uid, call.req._id)
|
||||
}
|
||||
// XstaskFun.delTask(call.uid, call.req._id);
|
||||
let send_prize = [];
|
||||
XstaskFun.changeInfo(call.uid, change);
|
||||
if (!await TeQuanFun.getXsTaskNum(call)) {
|
||||
send_prize = taskConf.prize;
|
||||
} else {
|
||||
for (let i = 0; i < 3; i++) {
|
||||
send_prize = send_prize.concat(taskConf.prize)
|
||||
}
|
||||
}
|
||||
await PlayerFun.sendPrize(call, send_prize);
|
||||
await PlayerFun.sendPrize(call, taskConf.prize);
|
||||
HongDianChange.sendChangeKey(call.uid, ['xstaskhd', 'huodonghd']);
|
||||
|
||||
call.succ({
|
||||
taskList: await XstaskFun.getAllTask(call.uid),
|
||||
prize: send_prize
|
||||
prize: taskConf.prize
|
||||
});
|
||||
}
|
@ -36,7 +36,7 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
||||
XstaskFun.delTasks(call.uid, delTask.map(task => task._id));
|
||||
}
|
||||
|
||||
// needAddTask += await TeQuanFun.getXsTaskNum(call);
|
||||
needAddTask += await TeQuanFun.getXsTaskNum(call);
|
||||
needAddTask && await XstaskFun.addTasks(call.uid, XstaskFun.randomTasks(taskInfo?.lv || changeInfo.lv, needAddTask));
|
||||
|
||||
let { _id, uid, type, ...info } = taskInfo || changeInfo as typeof taskInfo;
|
||||
|
Loading…
Reference in New Issue
Block a user