Merge branch 'feature/huangqijiuguan' into dev
This commit is contained in:
commit
c791bc152c
@ -5,6 +5,7 @@ import { PublicShared } from "../../../shared/public/public"
|
||||
import { EmailFun } from "../../../public/email"
|
||||
import { playerInfo } from "../../../shared/protocols/user/PtlLogin"
|
||||
import { PlayerFun } from "../../../public/player"
|
||||
import { Player } from "../../../shared/fightControl/Player"
|
||||
|
||||
// hddata.data
|
||||
export interface Data {
|
||||
@ -44,6 +45,10 @@ export interface Data {
|
||||
bossTask: { id: number, need: number, prize: atn[] }[]
|
||||
|
||||
bossRank: { id: string, rank: [number, number], prize: atn[] }
|
||||
|
||||
zhuanhuan: { start: atn, end: atn }[]
|
||||
end_mail_title: string
|
||||
end_mail_des: string
|
||||
}
|
||||
|
||||
export interface PlayerData {
|
||||
@ -279,13 +284,14 @@ export default class HQJGFun {
|
||||
htype: this.htype, rtime: { $gt: yesterday, $lte: today }
|
||||
}).toArray();
|
||||
|
||||
// 没有活动数
|
||||
if (hdinfo.length <= 0) {
|
||||
// 没有活动数 或者发奖标识已设置
|
||||
if (hdinfo.length <= 0 || hdinfo[0].data.sendrank) {
|
||||
return
|
||||
}
|
||||
|
||||
let hd = hdinfo[0];
|
||||
let hdid = hdinfo[0].hdid;
|
||||
let hddata = hdinfo[0].data as Data;
|
||||
if (hd.data.sendrank) {
|
||||
return
|
||||
}
|
||||
@ -317,6 +323,36 @@ export default class HQJGFun {
|
||||
await G.mongodb.collection("hdinfo").updateOne(
|
||||
{ hdid: hdid }, { $set: { "data.sendrank": true } }
|
||||
);
|
||||
// 货币兑换
|
||||
G.mongodb.collection("user").find().toArray().then(async (users) => {
|
||||
for (let i = 0; i < users.length; i++) {
|
||||
let prize = [];
|
||||
let change = {};
|
||||
let user = users[i];
|
||||
for (let con of hddata.zhuanhuan) {
|
||||
let num = user[con.start.t];
|
||||
if (num < con.start.n) {
|
||||
continue
|
||||
}
|
||||
change[con.start.t] = 0;
|
||||
prize.push({
|
||||
a: con.end.a, t: con.end.t, n: con.end.n * (num / con.start.n),
|
||||
})
|
||||
}
|
||||
if (prize.length <= 0) continue
|
||||
// 扣除消耗
|
||||
await PlayerFun.changeAttr(user.uid, change);
|
||||
G.server?.sendMsgByUid(user.uid, "msg_s2c/PlayerChange", change);
|
||||
// 发送奖励邮件
|
||||
await EmailFun.addEmail({
|
||||
uid: user.uid,
|
||||
type: "system",
|
||||
prize: prize,
|
||||
title: hddata.end_mail_title,
|
||||
content: hddata.end_mail_des,
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
console.log(
|
||||
"黄旗酒馆 最大伤害排行奖励结算 执行结束!!!"
|
||||
|
Loading…
Reference in New Issue
Block a user