Merge branch 'bugfix' of http://git.legu.cc/qixin/HJ_Server into bugfix
This commit is contained in:
commit
a9a5193efe
@ -1,6 +1,4 @@
|
||||
import {ApiCall} from "tsrpc";
|
||||
import {EventFun} from '../public/event/event';
|
||||
import {PayFun} from '../public/pay';
|
||||
import {ReqSyncBtn, ResSyncBtn, syncBtnKeys} from "../shared/protocols/PtlSyncBtn";
|
||||
import {PublicShared} from '../shared/public/public';
|
||||
import {HuoDongFun} from "../public/huodongfun";
|
||||
@ -65,39 +63,40 @@ export default async function (call: ApiCall<ReqSyncBtn, ResSyncBtn>) {
|
||||
break;
|
||||
case 'zhanling':
|
||||
//30天一轮循环,不管奖励。常驻活动
|
||||
if (!PublicShared.getEventIsOpen(G.gc.zhanling.eventOpen, call.conn.gud)) {
|
||||
data[key] = {active: false};
|
||||
} else {
|
||||
let zls = await G.mongodb.collection('scheduler').findOne({type: 'zhanling'});
|
||||
if (!data[key] || data[key].round != zls?.round) {
|
||||
let lastRunTime = zls && zls.lastRunTime? zls.lastRunTime : G.time
|
||||
let round = zls && zls.lastRunTime? zls.round : 1
|
||||
data[key] = {active: true, sTime: lastRunTime, round: round};
|
||||
change[key] = data[key];
|
||||
// if (!PublicShared.getEventIsOpen(G.gc.zhanling.eventOpen, call.conn.gud)) {
|
||||
// data[key] = {active: false};
|
||||
// } else {
|
||||
// let zls = await G.mongodb.collection('scheduler').findOne({type: 'zhanling'});
|
||||
// if (!data[key] || data[key].round != (zls?.round || 0)) {
|
||||
// let lastRunTime = zls && zls.lastRunTime? zls.lastRunTime : G.time
|
||||
// let round = zls && zls.lastRunTime? zls.round : 1
|
||||
|
||||
PayFun.delPayLog(call.uid, {payId: G.gc.zhanling.payId, val: []});
|
||||
// data[key] = {active: true, sTime: lastRunTime, round: round};
|
||||
// change[key] = data[key];
|
||||
|
||||
G.mongodb.cEvent('zhanling').findOne({uid: call.uid, type: 'zhanling'}).then(data => {
|
||||
//新一轮战令 不管玩家多久没上线 只补发玩家上一轮没有领取的奖励
|
||||
data && EventFun.reissueZhanLingPrize(data, call.conn.gud);
|
||||
// PayFun.delPayLog(call.uid, {payId: G.gc.zhanling.payId, val: []});
|
||||
|
||||
G.mongodb.cEvent('zhanling').updateOne(
|
||||
{uid: call.uid, type: 'zhanling'},
|
||||
{
|
||||
$set: {
|
||||
lv: 1,
|
||||
exp: 0,
|
||||
rec: {},
|
||||
isPay: false,
|
||||
taskRec: [],
|
||||
refreshTime: G.time
|
||||
}
|
||||
},
|
||||
{upsert: true}
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
// G.mongodb.cEvent('zhanling').findOne({uid: call.uid, type: 'zhanling'}).then(data => {
|
||||
// //新一轮战令 不管玩家多久没上线 只补发玩家上一轮没有领取的奖励
|
||||
// data && EventFun.reissueZhanLingPrize(data, call.conn.gud);
|
||||
|
||||
// G.mongodb.cEvent('zhanling').updateOne(
|
||||
// {uid: call.uid, type: 'zhanling'},
|
||||
// {
|
||||
// $set: {
|
||||
// lv: 1,
|
||||
// exp: 0,
|
||||
// rec: {},
|
||||
// isPay: false,
|
||||
// taskRec: [],
|
||||
// refreshTime: G.time
|
||||
// }
|
||||
// },
|
||||
// {upsert: true}
|
||||
// );
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
break;
|
||||
case 'xianshilibao':
|
||||
// 到时间消失
|
||||
|
@ -1,14 +1,16 @@
|
||||
import {ApiCall} from "tsrpc";
|
||||
import {ZhanLingTasks} from '../../../public/zhanling';
|
||||
import {ReqOpen, ResOpen} from "../../../shared/protocols/event/zhanling/PtlOpen";
|
||||
import {player} from '../../../shared/protocols/user/type';
|
||||
import {PublicShared} from '../../../shared/public/public';
|
||||
import { ApiCall } from "tsrpc";
|
||||
import { ZhanLingTasks } from '../../../public/zhanling';
|
||||
import { ReqOpen, ResOpen } from "../../../shared/protocols/event/zhanling/PtlOpen";
|
||||
import { player } from '../../../shared/protocols/user/type';
|
||||
import { PublicShared } from '../../../shared/public/public';
|
||||
import { PayFun } from "../../../public/pay";
|
||||
|
||||
export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
||||
let zls = await G.mongodb.collection('scheduler').findOne({type: 'zhanling'});
|
||||
let data = await G.mongodb.cEvent('zhanling').findOne({uid: call.uid, type: 'zhanling'});
|
||||
call.error(lng.huodong_open_1)
|
||||
let zls = await G.mongodb.collection('scheduler').findOne({ type: 'zhanling' });
|
||||
let data = await G.mongodb.cEvent('zhanling').findOne({ uid: call.uid, type: 'zhanling' });
|
||||
|
||||
if (!data || data.round != (zls?.round | 0)) {
|
||||
if (!data || data.round != (zls?.round || 0)) {
|
||||
let set = {
|
||||
lv: 1,
|
||||
exp: 0,
|
||||
@ -16,18 +18,22 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
||||
isPay: false,
|
||||
taskRec: [],
|
||||
round: zls?.round || 0,
|
||||
reWeekTime:G.time,
|
||||
reWeekTime: G.time,
|
||||
refreshTime: G.time,
|
||||
}
|
||||
|
||||
await PayFun.delPayLog(
|
||||
call.uid, { payId: G.gc.zhanling.payId, val: [] }
|
||||
);
|
||||
|
||||
data = (await G.mongodb.cEvent('zhanling').findOneAndUpdate({
|
||||
uid: call.uid,
|
||||
type: 'zhanling'
|
||||
}, {$set: set}, {upsert: true, returnDocument: 'after'})).value;
|
||||
}, { $set: set }, { upsert: true, returnDocument: 'after' })).value;
|
||||
}
|
||||
|
||||
if (PublicShared.getToWeekMondayZeroTime() > data.reWeekTime || PublicShared.getToDayZeroTime() > data.refreshTime) {
|
||||
let set: any = {taskRec: []};
|
||||
let set: any = { taskRec: [] };
|
||||
|
||||
let reType = [];
|
||||
if (PublicShared.getToWeekMondayZeroTime() > data.reWeekTime) {
|
||||
@ -49,11 +55,11 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
||||
data = (await G.mongodb.cEvent('zhanling').findOneAndUpdate({
|
||||
uid: call.uid,
|
||||
type: 'zhanling'
|
||||
}, {$set: set}, {upsert: true, returnDocument: 'after'})).value;
|
||||
}, { $set: set }, { upsert: true, returnDocument: 'after' })).value;
|
||||
}
|
||||
|
||||
let tasks = G.gc.zhanling.task.map(t => {
|
||||
return {type: t.type as 'day' | 'week' | 'round', key: t.taskId};
|
||||
return { type: t.type as 'day' | 'week' | 'round', key: t.taskId };
|
||||
});
|
||||
let taskFinished = await ZhanLingTasks.getLog(call.uid, tasks);
|
||||
|
||||
@ -68,14 +74,14 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
||||
}
|
||||
|
||||
export async function payZhanLing(player: player) {
|
||||
let zlData = await G.mongodb.cEvent('zhanling').findOne({uid: player.uid, type: 'zhanling'});
|
||||
let zlData = await G.mongodb.cEvent('zhanling').findOne({ uid: player.uid, type: 'zhanling' });
|
||||
let curLv = zlData?.lv || 1;
|
||||
let maxLv = Number(Object.keys(G.gc.zhanling.lv).slice(-1)[0]);
|
||||
let addLv = maxLv - curLv >= G.gc.zhanling.payAddLv ? G.gc.zhanling.payAddLv : maxLv - curLv;
|
||||
|
||||
await G.mongodb.cEvent('zhanling').updateOne(
|
||||
{uid: player.uid, type: 'zhanling'},
|
||||
{$set: {isPay: true, exp: G.gc.zhanling.lv[curLv + addLv], lv: curLv + addLv}},
|
||||
{upsert: true}
|
||||
{ uid: player.uid, type: 'zhanling' },
|
||||
{ $set: { isPay: true, exp: G.gc.zhanling.lv[curLv + addLv], lv: curLv + addLv } },
|
||||
{ upsert: true }
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue
Block a user