Merge branch 'bugfix' into dev
This commit is contained in:
commit
2a35b81f78
@ -69,7 +69,7 @@ export default async function (call: ApiCall<ReqSyncBtn, ResSyncBtn>) {
|
||||
data[key] = {active: false};
|
||||
} else {
|
||||
let zls = await G.mongodb.collection('scheduler').findOne({type: 'zhanling'});
|
||||
if (!data[key] || data[key].round != zls.round) {
|
||||
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};
|
||||
|
@ -3,19 +3,56 @@ import { PlayerFun } from '../../public/player';
|
||||
import { ReqRec, ResRec } from "../../shared/protocols/conglinshoulie/PtlRec";
|
||||
import { HongDianChange } from "../hongdian/fun";
|
||||
import { addStar, clslDb } from './ApiOpen';
|
||||
import { EmailFun } from "../../public/email";
|
||||
|
||||
export default async function (call: ApiCall<ReqRec, ResRec>) {
|
||||
let conf = G.gc.clsl_com.fightWinPrize[call.req.index];
|
||||
if (!conf) return call.errorCode(-1);
|
||||
|
||||
let db = await clslDb().findOne({ uid: call.uid, type: 'clsl' });
|
||||
|
||||
let curStar = db?.allStar || 0;
|
||||
let danPrize = db?.danPrize || [];
|
||||
let curMaxStar = db?.curMaxStar || 0;
|
||||
|
||||
if ((db?.fightWinNum || 0) < conf.total || db?.recWinPrize?.includes(call.req.index)) return call.errorCode(-2);
|
||||
|
||||
await PlayerFun.sendPrize(call, conf.prize);
|
||||
|
||||
addStar(call, conf.star);
|
||||
let updata = { $push: { recWinPrize: call.req.index } };
|
||||
|
||||
clslDb().updateOne({ uid: call.uid, type: 'clsl' }, { $push: { recWinPrize: call.req.index } });
|
||||
// 首次达到某个段位
|
||||
if (curStar + conf.star > curMaxStar) {
|
||||
curMaxStar += conf.star;
|
||||
updata["$inc"] = { "curMaxStar": conf.star };
|
||||
}
|
||||
|
||||
// 段位奖励邮件
|
||||
let title = G.gc.clsl_com.email_dan.title;
|
||||
let content = G.gc.clsl_com.email_dan.content;
|
||||
G.gc.clsl_com.danPrize.forEach(conf => {
|
||||
// 段位未达到 或者 奖励已经发放
|
||||
if (conf.star > curMaxStar || danPrize.includes(conf.star)) {
|
||||
return
|
||||
}
|
||||
|
||||
// 发放邮件
|
||||
EmailFun.addEmail({
|
||||
uid: call.uid,
|
||||
type: 'system',
|
||||
title: title,
|
||||
content: content,
|
||||
prize: conf.prize,
|
||||
contentInsertArr:[conf.title]
|
||||
})
|
||||
|
||||
danPrize.push(conf.star);
|
||||
updata["$set"] = { danPrize: danPrize };
|
||||
})
|
||||
|
||||
|
||||
addStar(call, conf.star, undefined, updata);
|
||||
// clslDb().updateOne({ uid: call.uid, type: 'clsl' }, { $push: { recWinPrize: call.req.index } });
|
||||
|
||||
HongDianChange.sendChangeKey(call.uid, ['clslhd'])
|
||||
|
||||
|
@ -32,7 +32,7 @@ export default async function (call: ApiCall<ReqReceive, ResReceive>) {
|
||||
prize.push(...gift[key]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (push.length > 0) {
|
||||
if (update["$push"]) {
|
||||
update["$push"]["record." + gift.id] = { $each: push }
|
||||
@ -71,7 +71,7 @@ export default async function (call: ApiCall<ReqReceive, ResReceive>) {
|
||||
|
||||
if (rec >= _payDiff || data?.record?.[gift.id] == call.req.recId) return call.errorCode(-3)
|
||||
|
||||
prize.concat(gift[call.req.recId]);
|
||||
prize.push(...gift[call.req.recId]);
|
||||
update = {
|
||||
$push: { [`record.${gift.id}`]: call.req.recId },
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ import { ApiCall } from "tsrpc";
|
||||
import { HuoDongFun } from "../../../public/huodongfun";
|
||||
import { ReqOpen, ResOpen } from "../../../shared/protocols/event/yangchengmubiao/PtlOpen";
|
||||
import { YangChengMuBiaofun } from "./fun";
|
||||
import { PayFun } from "../../../public/pay";
|
||||
import { payLog } from "../../../shared/protocols/pay/PtlGetList";
|
||||
|
||||
export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
||||
let _hdinfo = await HuoDongFun.getHdidInfo(call, call.req.hdid)
|
||||
@ -9,6 +11,23 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
||||
// 无此活动
|
||||
return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 })
|
||||
}
|
||||
|
||||
let delPay: { payId: string, val: payLog[] }[] = [];
|
||||
let payIds = _hdinfo.data.gift.map(v => v.payId);
|
||||
let payLogs = await PayFun.getPayLogs(call.uid, payIds);
|
||||
|
||||
for (let payid in payLogs) {
|
||||
if (payLogs[payid].length > 0) {
|
||||
if (payIds[payIds].slice(-1)[0].time < _hdinfo.stime) {
|
||||
delPay.push({ payId: payid, val: [] });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (delPay.length > 0) {
|
||||
await PayFun.delPayLog(call.uid, ...delPay);
|
||||
}
|
||||
|
||||
let _mydata = await YangChengMuBiaofun.getMyData(call, call.req.hdid)
|
||||
let changedata = { mydata: _mydata, hdinfo: _hdinfo }
|
||||
call.succ(changedata);
|
||||
|
98
src/fix_patch/patch_20240106.ts
Normal file
98
src/fix_patch/patch_20240106.ts
Normal file
@ -0,0 +1,98 @@
|
||||
import { log } from "console";
|
||||
import { patchFun, patchInit } from "../patch";
|
||||
import { TanXianFun } from "../public/tanxian";
|
||||
import { PublicShared } from "../shared/public/public";
|
||||
|
||||
class Path {
|
||||
|
||||
async fun1(a: any) {
|
||||
let hd = [{
|
||||
"hdid": 3001, // 唯一活动id 传说之路
|
||||
"htype": 3, // 后端唯一识别标识
|
||||
"stype": 300, // 前端唯一识别标识(看前端需要是否修改)
|
||||
"ttype": 1, // 0 按照开服时间计算,1 玩家注册时间计算 4 屏蔽此活动
|
||||
"stime": 30, // 活动开始天数
|
||||
"rtime": 60, // 活动显示结束天数
|
||||
"etime": 60, // 活动实际结束
|
||||
"name": "xinfupeiyang",
|
||||
"icon": "icon_qiridenglu",
|
||||
"showtime": "仅供参考,会复写正确值",
|
||||
"data": {
|
||||
//干部id
|
||||
hid: '5002',
|
||||
//任务
|
||||
task: [
|
||||
{ idx: 0, total: 80, type: 'lv', prize: [{ a: 'item', t: '1', n: 500000 }], des: 'intr_cszl_des_2' },
|
||||
{ idx: 1, total: 4, type: 'jieji', prize: [{ a: 'item', t: '12', n: 500 }], des: 'intr_cszl_des_1' },
|
||||
{ idx: 2, total: 120, type: 'lv', prize: [{ a: 'item', t: '1', n: 500000 }], des: 'intr_cszl_des_2' },
|
||||
{ idx: 3, total: 5, type: 'jieji', prize: [{ a: 'item', t: '12', n: 1000 }], des: 'intr_cszl_des_1' },
|
||||
{ idx: 4, total: 160, type: 'lv', prize: [{ a: 'item', t: '1', n: 800000 }], des: 'intr_cszl_des_2' },
|
||||
{ idx: 5, total: 6, type: 'jieji', prize: [{ a: 'item', t: '12', n: 1500 }], des: 'intr_cszl_des_1' },
|
||||
{ idx: 6, total: 200, type: 'lv', prize: [{ a: 'item', t: '1', n: 1200000 }], des: 'intr_cszl_des_2' },
|
||||
{ idx: 7, total: 7, type: 'jieji', prize: [{ a: 'item', t: '12', n: 2000 }], des: 'intr_cszl_des_1' },
|
||||
{ idx: 8, total: 240, type: 'lv', prize: [{ a: 'item', t: '1', n: 2000000 }], des: 'intr_cszl_des_2' },
|
||||
{ idx: 9, total: 8, type: 'jieji', prize: [{ a: 'item', t: '5002', n: 20 }], des: 'intr_cszl_des_1' }
|
||||
],
|
||||
//宝箱
|
||||
box: { total: 10, prize: [{ a: 'item', t: '610', n: 1 }] }
|
||||
}
|
||||
},
|
||||
{
|
||||
"hdid": 3002, // 唯一活动id 传说之路 心腹培养
|
||||
"htype": 3, // 后端唯一识别标识
|
||||
"stype": 300, // 前端唯一识别标识(看前端需要是否修改)
|
||||
"ttype": 1, // 0 按照开服时间计算,1 玩家注册时间计算 4 屏蔽此活动
|
||||
"stime": 60, // 活动开始天数
|
||||
"rtime": 90, // 活动显示结束天数
|
||||
"etime": 90, // 活动实际结束
|
||||
"name": "xinfupeiyang",
|
||||
"icon": "icon_xfdj",
|
||||
"showtime": "仅供参考,会复写正确值",
|
||||
"data": {
|
||||
//干部id
|
||||
hid: '5004',
|
||||
//任务
|
||||
task: [
|
||||
{ idx: 0, total: 100, type: 'lv', prize: [{ a: 'item', t: '1', n: 500000 }], des: 'intr_cszl_des_2' },
|
||||
{ idx: 1, total: 5, type: 'jieji', prize: [{ a: 'item', t: '12', n: 500 }], des: 'intr_cszl_des_1' },
|
||||
{ idx: 2, total: 140, type: 'lv', prize: [{ a: 'item', t: '1', n: 500000 }], des: 'intr_cszl_des_2' },
|
||||
{ idx: 3, total: 6, type: 'jieji', prize: [{ a: 'item', t: '12', n: 1000 }], des: 'intr_cszl_des_1' },
|
||||
{ idx: 4, total: 180, type: 'lv', prize: [{ a: 'item', t: '1', n: 800000 }], des: 'intr_cszl_des_2' },
|
||||
{ idx: 5, total: 7, type: 'jieji', prize: [{ a: 'item', t: '12', n: 1500 }], des: 'intr_cszl_des_1' },
|
||||
{ idx: 6, total: 220, type: 'lv', prize: [{ a: 'item', t: '1', n: 1200000 }], des: 'intr_cszl_des_2' },
|
||||
{ idx: 7, total: 8, type: 'jieji', prize: [{ a: 'item', t: '12', n: 2000 }], des: 'intr_cszl_des_1' },
|
||||
{ idx: 8, total: 260, type: 'lv', prize: [{ a: 'item', t: '1', n: 2000000 }], des: 'intr_cszl_des_2' },
|
||||
{ idx: 9, total: 9, type: 'jieji', prize: [{ a: 'item', t: '5004', n: 20 }], des: 'intr_cszl_des_1' }
|
||||
],
|
||||
//宝箱
|
||||
box: { total: 10, prize: [{ a: 'item', t: '610', n: 1 }] }
|
||||
}
|
||||
}]
|
||||
|
||||
for (let i = 0; i < hd.length; i++) {
|
||||
G.mongodb.collection('hdinfo').updateOne(
|
||||
{ hdid: hd[i].hdid }, { $set: { ["data.task"]: hd[i].data.task } }, { upsert: true }
|
||||
)
|
||||
}
|
||||
|
||||
return "sucess!!!"
|
||||
}
|
||||
|
||||
|
||||
|
||||
async run() {
|
||||
await this.fun1(1);
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
await patchInit()
|
||||
let patch = new Path();
|
||||
await patch.run();
|
||||
console.log("逻辑执行完成,等待退出");
|
||||
setTimeout(function () {
|
||||
console.log('结束程序');
|
||||
process.exit();
|
||||
}, 3000);
|
||||
}
|
||||
main();
|
@ -46,13 +46,13 @@
|
||||
},
|
||||
{
|
||||
"key":"pata/SaoDang",
|
||||
"limit":5,
|
||||
"tips":"黑暗塔扫荡次数超过5次"
|
||||
"limit":6,
|
||||
"tips":"黑暗塔扫荡次数超过6次"
|
||||
},
|
||||
{
|
||||
"key":"lingzhulaixi/PkBoss",
|
||||
"limit":15,
|
||||
"tips":"讨伐海盗挑战次数超过15次"
|
||||
"limit":16,
|
||||
"tips":"讨伐海盗挑战次数超过16次"
|
||||
},
|
||||
{
|
||||
"key":"gonghui/FbFight",
|
||||
|
Loading…
Reference in New Issue
Block a user