修改情报特权
This commit is contained in:
xcy 2023-12-15 20:06:20 +08:00 committed by dy
parent 94bf56cc9e
commit db2286509c
3 changed files with 42 additions and 23 deletions

View File

@ -1,15 +1,17 @@
import { ApiCall } from "tsrpc"; import {ApiCall} from "tsrpc";
import { PlayerFun } from '../../public/player'; import {PlayerFun} from '../../public/player';
import { XstaskFun } from '../../public/xstask'; import {XstaskFun} from '../../public/xstask';
import { ReqAllGet, ResAllGet } from "../../shared/protocols/xstask/PtlAllGet"; import {ReqAllGet, ResAllGet} from "../../shared/protocols/xstask/PtlAllGet";
import { HongDianChange } from "../hongdian/fun"; import {HongDianChange} from "../hongdian/fun";
import { PublicShared } from "../../shared/public/public"; import {PublicShared} from "../../shared/public/public";
import {TeQuanFun} from "../../public/tequan";
export default async function (call: ApiCall<ReqAllGet, ResAllGet>) { export default async function (call: ApiCall<ReqAllGet, ResAllGet>) {
const taskList = JSON.parse(JSON.stringify(await XstaskFun.getAllTask(call.uid))); const taskList = JSON.parse(JSON.stringify(await XstaskFun.getAllTask(call.uid)));
let taskInfo = await XstaskFun.getInfo(call.uid); let taskInfo = await XstaskFun.getInfo(call.uid);
let prizeArr:atn[] = [] let tequan = await TeQuanFun.getXsTaskNum(call);
for(let task of taskList) { let prizeArr: atn[] = []
for (let task of taskList) {
const taskConf = G.gc.xstask[task?.taskId]; const taskConf = G.gc.xstask[task?.taskId];
if (!task) continue; if (!task) continue;
if (task.receiveData == undefined) continue; if (task.receiveData == undefined) continue;
@ -23,10 +25,10 @@ export default async function (call: ApiCall<ReqAllGet, ResAllGet>) {
// } // }
continue continue
} }
let change: Parameters<typeof XstaskFun.changeInfo>[1] = { $inc: {} }; let change: Parameters<typeof XstaskFun.changeInfo>[1] = {$inc: {}};
change.$inc[`finishNum.${taskConf.colour}`] = 1; change.$inc[`finishNum.${taskConf.colour}`] = 1;
// 比对派遣时间如果小于当日0点则更新新任务否则该变领取状态为true // 比对派遣时间如果小于当日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) XstaskFun.updateTask(call.uid, task._id, newTask[0].taskId)
@ -38,6 +40,14 @@ export default async function (call: ApiCall<ReqAllGet, ResAllGet>) {
XstaskFun.changeInfo(call.uid, change); XstaskFun.changeInfo(call.uid, change);
await PlayerFun.sendPrize(call, taskConf.prize); await PlayerFun.sendPrize(call, taskConf.prize);
HongDianChange.sendChangeKey(call.uid, ['xstaskhd', 'huodonghd']); 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) prizeArr.push(...taskConf.prize)
} }
call.succ({ call.succ({

View File

@ -1,9 +1,10 @@
import { ApiCall } from "tsrpc"; import {ApiCall} from "tsrpc";
import { PlayerFun } from '../../public/player'; import {PlayerFun} from '../../public/player';
import { XstaskFun } from '../../public/xstask'; import {XstaskFun} from '../../public/xstask';
import { ReqGet, ResGet } from "../../shared/protocols/xstask/PtlGet"; import {ReqGet, ResGet} from "../../shared/protocols/xstask/PtlGet";
import { HongDianChange } from "../hongdian/fun"; import {HongDianChange} from "../hongdian/fun";
import { PublicShared } from '../../shared/public/public'; import {PublicShared} from '../../shared/public/public';
import {TeQuanFun} from "../../public/tequan";
export default async function (call: ApiCall<ReqGet, ResGet>) { export default async function (call: ApiCall<ReqGet, ResGet>) {
@ -23,10 +24,10 @@ 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; change.$inc[`finishNum.${taskConf.colour}`] = 1;
// 比对派遣时间如果小于当日0点则更新新任务否则该变领取状态为true // 比对派遣时间如果小于当日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) XstaskFun.updateTask(call.uid, call.req._id, newTask[0].taskId)
@ -35,12 +36,20 @@ export default async function (call: ApiCall<ReqGet, ResGet>) {
XstaskFun.finishTask(call.uid, call.req._id) XstaskFun.finishTask(call.uid, call.req._id)
} }
// XstaskFun.delTask(call.uid, call.req._id); // XstaskFun.delTask(call.uid, call.req._id);
let send_prize = [];
XstaskFun.changeInfo(call.uid, change); XstaskFun.changeInfo(call.uid, change);
await PlayerFun.sendPrize(call, taskConf.prize); 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);
HongDianChange.sendChangeKey(call.uid, ['xstaskhd', 'huodonghd']); HongDianChange.sendChangeKey(call.uid, ['xstaskhd', 'huodonghd']);
call.succ({ call.succ({
taskList: await XstaskFun.getAllTask(call.uid), taskList: await XstaskFun.getAllTask(call.uid),
prize: taskConf.prize prize: send_prize
}); });
} }

View File

@ -36,7 +36,7 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
XstaskFun.delTasks(call.uid, delTask.map(task => task._id)); 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)); needAddTask && await XstaskFun.addTasks(call.uid, XstaskFun.randomTasks(taskInfo?.lv || changeInfo.lv, needAddTask));
let { _id, uid, type, ...info } = taskInfo || changeInfo as typeof taskInfo; let { _id, uid, type, ...info } = taskInfo || changeInfo as typeof taskInfo;