活动:限时排行榜和充值修改
This commit is contained in:
@@ -68,10 +68,14 @@ export async function sendRankMail(data: TimeLimitRankData) {
|
|||||||
if(r.infoKey == REDIS_KEY.GUILD_INFO) {
|
if(r.infoKey == REDIS_KEY.GUILD_INFO) {
|
||||||
let allRank = <GuildRankInfo[]>(await r.getRankByRange());
|
let allRank = <GuildRankInfo[]>(await r.getRankByRange());
|
||||||
|
|
||||||
for(let { rank, code, name } of allRank) {
|
for(let { rank, code, name, leader } of allRank) {
|
||||||
let reward = data.getRewardByRank(rank);
|
let reward = data.getRewardByRank(rank);
|
||||||
if(reward) {
|
if(reward) {
|
||||||
await sendMailToGuildByContent(MAIL_TYPE.TIME_LIMIT_RANK, code, {
|
await sendMailToGuildByContent(MAIL_TYPE.TIME_LIMIT_RANK, code, {
|
||||||
|
params: [data.tabName,`${rank}`],
|
||||||
|
goods: stringToRewardInter(reward.guildRewards)
|
||||||
|
});
|
||||||
|
if(leader.roleId) await sendMailByContent(MAIL_TYPE.TIME_LIMIT_RANK, leader.roleId, {
|
||||||
params: [data.tabName,`${rank}`],
|
params: [data.tabName,`${rank}`],
|
||||||
goods: stringToRewardInter(reward.rewards)
|
goods: stringToRewardInter(reward.rewards)
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,15 +15,10 @@ interface RechargeMoneyWeightInDb {
|
|||||||
weight: number; // 权重,先随机出这个品级的物品的概率,然后再平均随机出这个品级下的物品
|
weight: number; // 权重,先随机出这个品级的物品的概率,然后再平均随机出这个品级下的物品
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RechargeMoneyPercentInDb {
|
|
||||||
todayIndex: number; // 第几天,和前面排名奖励的填法一样,如第1天、第2-10天,只需填todayIndex=1和10的两项
|
|
||||||
data: RechargeMoneyWeightInDb[]; // 这一天的权重
|
|
||||||
}
|
|
||||||
|
|
||||||
interface RechargeMoneyInDb {
|
interface RechargeMoneyInDb {
|
||||||
pool: RechargeMoneyPoolInDb[];
|
pool: RechargeMoneyPoolInDb[];
|
||||||
minPrice: number;
|
minPrice: number;
|
||||||
percent: RechargeMoneyPercentInDb[];
|
percent: RechargeMoneyWeightInDb[];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 充值记录
|
// 充值记录
|
||||||
@@ -56,25 +51,13 @@ export class RechargeMoneyWeight {
|
|||||||
this.weight = data.weight;
|
this.weight = data.weight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export class RechargeMoneyPercent {
|
|
||||||
todayIndex: number;
|
|
||||||
data: RechargeMoneyWeight[] = [];
|
|
||||||
|
|
||||||
constructor(data: RechargeMoneyPercentInDb) {
|
|
||||||
this.todayIndex = data.todayIndex;
|
|
||||||
for(let obj of data.data) {
|
|
||||||
this.data.push(new RechargeMoneyWeight(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 累计充值数据
|
// 累计充值数据
|
||||||
export class RechargeMoneyData extends ActivityBase {
|
export class RechargeMoneyData extends ActivityBase {
|
||||||
private map: Map<number, number> = new Map(); // poolId => index
|
private map: Map<number, number> = new Map(); // poolId => index
|
||||||
private percentMap: Map<number, number> = new Map(); // todayIndex => 的index
|
|
||||||
pool: RechargeMoneyPool[] = [];
|
pool: RechargeMoneyPool[] = [];
|
||||||
minPrice: number = 0;
|
minPrice: number = 0;
|
||||||
percent: RechargeMoneyPercent[] = [];
|
percent: RechargeMoneyWeight[] = [];
|
||||||
|
|
||||||
ticketCnt: number = 0; // 签数
|
ticketCnt: number = 0; // 签数
|
||||||
recordArr: ActivityRechargeMoneyModelType[] = [];
|
recordArr: ActivityRechargeMoneyModelType[] = [];
|
||||||
@@ -84,15 +67,9 @@ export class RechargeMoneyData extends ActivityBase {
|
|||||||
return this.pool[index];
|
return this.pool[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
private findTodayPercent() {
|
|
||||||
let index = this.percentMap.get(this.todayIndex);
|
|
||||||
return this.percent[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
public pull() {
|
public pull() {
|
||||||
let percent = this.findTodayPercent();
|
let percent = this.percent;
|
||||||
if(!percent) return false;
|
let randPercent = percent.filter(cur => {
|
||||||
let randPercent = percent.data.filter(cur => {
|
|
||||||
let hasAllGet = true;
|
let hasAllGet = true;
|
||||||
for(let { quality, hasGet } of this.pool) {
|
for(let { quality, hasGet } of this.pool) {
|
||||||
if(quality == cur.quality && !hasGet) hasAllGet = false;
|
if(quality == cur.quality && !hasGet) hasAllGet = false;
|
||||||
@@ -150,9 +127,8 @@ export class RechargeMoneyData extends ActivityBase {
|
|||||||
}
|
}
|
||||||
this.minPrice = dataObj.minPrice;
|
this.minPrice = dataObj.minPrice;
|
||||||
for(let percent of dataObj.percent) {
|
for(let percent of dataObj.percent) {
|
||||||
let obj = new RechargeMoneyPercent(percent);
|
let obj = new RechargeMoneyWeight(percent);
|
||||||
this.percent.push(obj);
|
this.percent.push(obj);
|
||||||
this.percentMap.set(obj.todayIndex, this.percent.length - 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { ActivityBase } from './activityField';
|
|||||||
interface TimeLimitRewardInDb {
|
interface TimeLimitRewardInDb {
|
||||||
rank: number; // 第几名
|
rank: number; // 第几名
|
||||||
rewards: string; // type&id&count
|
rewards: string; // type&id&count
|
||||||
|
guildRewards: string; // 军团整体奖励
|
||||||
}
|
}
|
||||||
|
|
||||||
interface TimeLimitInDb {
|
interface TimeLimitInDb {
|
||||||
@@ -20,10 +21,12 @@ interface TimeLimitInDb {
|
|||||||
export class TimeLimitRankReward {
|
export class TimeLimitRankReward {
|
||||||
rank: number
|
rank: number
|
||||||
rewards: string;
|
rewards: string;
|
||||||
|
guildRewards: string;
|
||||||
|
|
||||||
constructor(data: TimeLimitRewardInDb) {
|
constructor(data: TimeLimitRewardInDb) {
|
||||||
this.rank = data.rank;
|
this.rank = data.rank;
|
||||||
this.rewards = data.rewards;
|
this.rewards = data.rewards;
|
||||||
|
this.guildRewards = data.guildRewards;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user