Merge branch 'bugfix' into release

This commit is contained in:
xichaoyin 2024-01-06 17:51:57 +08:00
commit ce3fd79126
2 changed files with 117 additions and 0 deletions

View File

@ -2,6 +2,8 @@ import { ApiCall } from "tsrpc";
import { HuoDongFun } from "../../../public/huodongfun"; import { HuoDongFun } from "../../../public/huodongfun";
import { ReqOpen, ResOpen } from "../../../shared/protocols/event/yangchengmubiao/PtlOpen"; import { ReqOpen, ResOpen } from "../../../shared/protocols/event/yangchengmubiao/PtlOpen";
import { YangChengMuBiaofun } from "./fun"; import { YangChengMuBiaofun } from "./fun";
import { PayFun } from "../../../public/pay";
import { payLog } from "../../../shared/protocols/pay/PtlGetList";
export default async function (call: ApiCall<ReqOpen, ResOpen>) { export default async function (call: ApiCall<ReqOpen, ResOpen>) {
let _hdinfo = await HuoDongFun.getHdidInfo(call, call.req.hdid) 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 }) 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 (payLogs[payid].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 _mydata = await YangChengMuBiaofun.getMyData(call, call.req.hdid)
let changedata = { mydata: _mydata, hdinfo: _hdinfo } let changedata = { mydata: _mydata, hdinfo: _hdinfo }
call.succ(changedata); call.succ(changedata);

View 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();