弹出礼包:添加同类型拦截参数
This commit is contained in:
@@ -108,26 +108,26 @@ export class PopUpShopHandler {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async debugPushPopUpShop(msg: { conditionType: number, magicWord: string, param: number }, session: BackendSession) {
|
async debugPushPopUpShop(msg: { conditionType: number, magicWord: string, param: number, needDelete: boolean }, session: BackendSession) {
|
||||||
const roleId = session.get('roleId');
|
const roleId = session.get('roleId');
|
||||||
let serverId = session.get('serverId');
|
let serverId = session.get('serverId');
|
||||||
const { magicWord, conditionType, param } = msg;
|
const { magicWord, conditionType, param } = msg;
|
||||||
if (magicWord !== DEBUG_MAGIC_WORD) {
|
if (magicWord !== DEBUG_MAGIC_WORD) {
|
||||||
return resResult(STATUS.TOKEN_ERR);
|
return resResult(STATUS.TOKEN_ERR);
|
||||||
}
|
}
|
||||||
let activities = await getActivitiesByType(serverId, ACTIVITY_TYPE.POP_UP_SHOP);
|
// let activities = await getActivitiesByType(serverId, ACTIVITY_TYPE.POP_UP_SHOP);
|
||||||
for(let { activityId } of activities) {
|
// for(let { activityId } of activities) {
|
||||||
let playerData = await getPopUpShopData(activityId, serverId, roleId);
|
// let playerData = await getPopUpShopData(activityId, serverId, roleId);
|
||||||
for(let pkg of playerData.packages) {
|
// for(let pkg of playerData.packages) {
|
||||||
if(pkg.conditionType == conditionType) {
|
// if(pkg.conditionType == conditionType) {
|
||||||
await ActivityPopUpShopModel.deleteMany({ roleId, activityId, id: pkg.id });
|
// await ActivityPopUpShopModel.deleteMany({ roleId, activityId, id: pkg.id });
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
let arr = await checkPopUpCondition(serverId, roleId, conditionType, {
|
let arr = await checkPopUpCondition(serverId, roleId, conditionType, {
|
||||||
oldLv: 0,
|
oldLv: param? param - 1: 0,
|
||||||
newLv: param||100,
|
newLv: param||100,
|
||||||
quality: param||3,
|
quality: param||3,
|
||||||
warId: param||128,
|
warId: param||128,
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ interface PopUpShopPackageInDb {
|
|||||||
items: PopUpShopItemInDb[]; // 礼包
|
items: PopUpShopItemInDb[]; // 礼包
|
||||||
duration: number; // 礼包弹出之后,持续时间,单位小时
|
duration: number; // 礼包弹出之后,持续时间,单位小时
|
||||||
keyItem: PopUpShopKeyItemIbDb[]; // 关键资源限制,refreshDay内可以获得Y个
|
keyItem: PopUpShopKeyItemIbDb[]; // 关键资源限制,refreshDay内可以获得Y个
|
||||||
|
checkPushingItem: number; // 是否在有同类型礼包的时候弹新礼包
|
||||||
refreshTimeType: number; // 刷新时间类型,0-不复现 1-自然日 2-自然周 3-自然月 4-从beginTime开始固定天 5-按pvp赛季
|
refreshTimeType: number; // 刷新时间类型,0-不复现 1-自然日 2-自然周 3-自然月 4-从beginTime开始固定天 5-按pvp赛季
|
||||||
refreshDay: number; // 上面刷新时间的具体天数,refreshTimeType=0-3都不会使用这个参数,refreshTimeType=4时这个表示固定几天
|
refreshDay: number; // 上面刷新时间的具体天数,refreshTimeType=0-3都不会使用这个参数,refreshTimeType=4时这个表示固定几天
|
||||||
pushCnt: number; // 在自然日cd之内,总推送次数,不复现的填0,不限制这个使用其他限制的填-1(如passCnt填次数的时候,这里填-1)
|
pushCnt: number; // 在自然日cd之内,总推送次数,不复现的填0,不限制这个使用其他限制的填-1(如passCnt填次数的时候,这里填-1)
|
||||||
@@ -149,6 +150,7 @@ export class PopUpShopPackage {
|
|||||||
id: number; // 弹出礼包id
|
id: number; // 弹出礼包id
|
||||||
conditionType: number; // 条件类型
|
conditionType: number; // 条件类型
|
||||||
canLvUp: number; // 是否可升降
|
canLvUp: number; // 是否可升降
|
||||||
|
checkPushingItem: number; // 是否在同类型礼包
|
||||||
duration: number; // 礼包弹出之后,持续时间,单位小时
|
duration: number; // 礼包弹出之后,持续时间,单位小时
|
||||||
refreshTimeType: number; // 刷新时间类型,0-不复现 1-自然日 2-自然周 3-自然月 4-从beginTime开始固定天
|
refreshTimeType: number; // 刷新时间类型,0-不复现 1-自然日 2-自然周 3-自然月 4-从beginTime开始固定天
|
||||||
refreshDay: number; // 复现自然日cd,不复现的填0,从弹出礼包那一天的凌晨5点开始计数
|
refreshDay: number; // 复现自然日cd,不复现的填0,从弹出礼包那一天的凌晨5点开始计数
|
||||||
@@ -175,6 +177,7 @@ export class PopUpShopPackage {
|
|||||||
this.conditionType = data.conditionType;
|
this.conditionType = data.conditionType;
|
||||||
this.canLvUp = data.canLvUp;
|
this.canLvUp = data.canLvUp;
|
||||||
this.duration = data.duration;
|
this.duration = data.duration;
|
||||||
|
this.checkPushingItem = data.checkPushingItem;
|
||||||
this.refreshTimeType = data.refreshTimeType;
|
this.refreshTimeType = data.refreshTimeType;
|
||||||
this.refreshDay = data.refreshDay;
|
this.refreshDay = data.refreshDay;
|
||||||
this.pushCnt = data.pushCnt;
|
this.pushCnt = data.pushCnt;
|
||||||
@@ -221,7 +224,8 @@ export class PopUpShopPackage {
|
|||||||
let item = this.findItemByProductID(itemData.productID);
|
let item = this.findItemByProductID(itemData.productID);
|
||||||
if(item) {
|
if(item) {
|
||||||
item.setPlayerRecords(data, itemData);
|
item.setPlayerRecords(data, itemData);
|
||||||
this.isPushing = true;
|
console.log('#### item.isPushing', item.isPushing)
|
||||||
|
if(item.isPushing) this.isPushing = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (data.beginTime < now && data.endTime < now) { // 已经结束了的
|
} else if (data.beginTime < now && data.endTime < now) { // 已经结束了的
|
||||||
@@ -251,9 +255,9 @@ export class PopUpShopPackage {
|
|||||||
console.log('######### 3.5.1', this.conditionType, conditionType, this.conditionType != conditionType)
|
console.log('######### 3.5.1', this.conditionType, conditionType, this.conditionType != conditionType)
|
||||||
if(this.conditionType != conditionType) return false;
|
if(this.conditionType != conditionType) return false;
|
||||||
// 2. 判断同类型是否是已经有在持续中的
|
// 2. 判断同类型是否是已经有在持续中的
|
||||||
console.log('######### 3.5.2', this.refreshTimeType, this.isPushing, this.refreshTimeType != 0 && this.isPushing)
|
console.log('######### 3.5.2', this.checkPushingItem, this.isPushing);
|
||||||
if(this.refreshTimeType != 0 && this.isPushing) return false;
|
if(this.checkPushingItem && this.isPushing) return false;
|
||||||
// // 3. 自然日内推送次数
|
// 3. 自然日内推送次数
|
||||||
console.log('######### 3.5.3', this.canLvUp, this.pushCnt, this.hasPushCnt, this.pushCnt != -1, this.hasPushCnt >= this.pushCnt)
|
console.log('######### 3.5.3', this.canLvUp, this.pushCnt, this.hasPushCnt, this.pushCnt != -1, this.hasPushCnt >= this.pushCnt)
|
||||||
if(this.canLvUp == 1 && this.pushCnt != -1 && this.hasPushCnt >= this.pushCnt) return false;
|
if(this.canLvUp == 1 && this.pushCnt != -1 && this.hasPushCnt >= this.pushCnt) return false;
|
||||||
// 4. 连续无视次数
|
// 4. 连续无视次数
|
||||||
@@ -388,7 +392,9 @@ export class PopShopItem {
|
|||||||
this.beginTime = data.beginTime.getTime();
|
this.beginTime = data.beginTime.getTime();
|
||||||
this.endTime = data.endTime.getTime();
|
this.endTime = data.endTime.getTime();
|
||||||
this.hasBoughtCnt = item.hasBoughtCnt;
|
this.hasBoughtCnt = item.hasBoughtCnt;
|
||||||
this.isPushing = true;
|
if(this.hasBoughtCnt < this.buyCnt) {
|
||||||
|
this.isPushing = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public addPushCnt() {
|
public addPushCnt() {
|
||||||
|
|||||||
Reference in New Issue
Block a user