Merge branch 'bugfix' of http://git.legu.cc/qixin/HJ_Server into bugfix

This commit is contained in:
ciniao 2024-01-08 14:03:23 +08:00
commit a9a5193efe
2 changed files with 54 additions and 49 deletions

View File

@ -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':
// 到时间消失

View File

@ -3,12 +3,14 @@ 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>) {
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,
@ -20,6 +22,10 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
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'