活动:修改结构

This commit is contained in:
qiaoxin
2021-06-30 11:41:38 +08:00
parent 550ec29842
commit 3cff8acf3a
60 changed files with 260 additions and 169 deletions

View File

@@ -263,7 +263,8 @@ export class GachaHandler {
let activityData = await ActivityModel.findActivity(activityId);
if (!activityData) return resResult(STATUS.ACTIVITY_MISSING);
let gachaData = new GachaData(activityData);
let { createTime } = await RoleModel.findByRoleId(roleId);
let gachaData = new GachaData(activityData, createTime);
heroes = gachaData.heroes;
if (!heroes.includes(pickHero)) {
return resResult(STATUS.GACHA_CAN_NOT_PICK)

View File

@@ -57,7 +57,8 @@ export class NewHeroGachaHandler {
const serverId = session.get('serverId');
let activityData: ActivityModelType = await ActivityModel.findActivity(activityId);
let playerData = new NewHeroGachaData(activityData);
let { createTime } = await RoleModel.findByRoleId(roleId);
let playerData = new NewHeroGachaData(activityData, createTime);
for (let pageData of playerData.list) {
await ActivityNewHeroGachaModel.selectedHero(serverId, activityId, roleId, pageData.hid, pageData.hid == hid);
}

View File

@@ -10,6 +10,7 @@ import { ActivityModel, ActivityModelType } from '../../../db/Activity';
import { addSelfServiceShopGiftReward, getSelfServiceShopActivityData, getPlayerActivityData } from '../../../services/activity/selfServiceShopActivityService';
import { addReward, stringToConsumeParam, stringToRewardParam } from '../../../services/activity/giftPackageService';
import { random } from 'underscore';
import { RoleModel } from '../../../db/Role';
export default function (app: Application) {
return new SelfServiceShopHandler(app);
@@ -53,7 +54,8 @@ export class SelfServiceShopHandler {
const funcs: number[] = session.get('funcs');
let activityData: ActivityModelType = await ActivityModel.findActivity(activityId);
let playerData = new SelfServiceShopData(activityData);
let { createTime } = await RoleModel.findByRoleId(roleId);
let playerData = new SelfServiceShopData(activityData, createTime);
let item = playerData.getItem(index);
if (item.countMax > 0) {//限制购买次数
@@ -112,7 +114,8 @@ export class SelfServiceShopHandler {
const funcs: number[] = session.get('funcs');
let activityData: ActivityModelType = await ActivityModel.findActivity(activityId);
let playerData = new SelfServiceShopData(activityData);
let { createTime } = await RoleModel.findByRoleId(roleId);
let playerData = new SelfServiceShopData(activityData, createTime);
let unitPrice = playerData.unitPrice;//购买价格
let unitCountMax = playerData.unitCountMax;//最大购买次数
let unitReward = playerData.unitReward;//购买获得资源

View File

@@ -60,7 +60,7 @@ export class ThirtyDaysHandler {
let activityDays = 0;
for (let i = 0; i < activityArray.length; i++) {
let playerData = new ThirtyDaysData(activityArray[i]);
let playerData = new ThirtyDaysData(activityArray[i], roleId);
if (playerData.activityId != activityId) {
activityDays += playerData.days;//周期天数
} else {

View File

@@ -34,7 +34,7 @@ export class TreasureHuntHandler {
const { activityId } = msg;
const roleId = session.get('roleId');
const serverId = session.get('serverId');
let { huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex, activityData } = await getTreasureHuntData(serverId);
let { huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex, activityData } = await getTreasureHuntData(serverId, roleId);
if (!activityData) {
return resResult(STATUS.ACTIVITY_MISSING, {});
}
@@ -57,7 +57,7 @@ export class TreasureHuntHandler {
const roleName = session.get('roleName');
const funcs: number[] = session.get('funcs');
let { huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex, activityData } = await getTreasureHuntData(serverId);
let { huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex, activityData } = await getTreasureHuntData(serverId, roleId);
if (!activityData) {
return resResult(STATUS.ACTIVITY_MISSING, {});
}
@@ -98,7 +98,7 @@ export class TreasureHuntHandler {
const roleName = session.get('roleName');
const funcs: number[] = session.get('funcs');
let { huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex, activityData } = await getTreasureHuntData(serverId);
let { huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex, activityData } = await getTreasureHuntData(serverId, roleId);
if (!activityData) {
return resResult(STATUS.ACTIVITY_MISSING, {});
}
@@ -150,7 +150,7 @@ export class TreasureHuntHandler {
const roleName = session.get('roleName');
const funcs: number[] = session.get('funcs');
let { huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex, activityData } = await getTreasureHuntData(serverId);
let { huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex, activityData } = await getTreasureHuntData(serverId, roleId);
if (!activityData) {
return resResult(STATUS.ACTIVITY_MISSING, {});
}
@@ -197,7 +197,7 @@ export class TreasureHuntHandler {
const roleName = session.get('roleName');
const funcs: number[] = session.get('funcs');
let { huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex, activityData } = await getTreasureHuntData(serverId);
let { huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex, activityData } = await getTreasureHuntData(serverId, roleId);
if (!activityData) {
return resResult(STATUS.ACTIVITY_MISSING, {});
}
@@ -234,7 +234,7 @@ export class TreasureHuntHandler {
const roleName = session.get('roleName');
const funcs: number[] = session.get('funcs');
let { huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex, activityData } = await getTreasureHuntData(serverId);
let { huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex, activityData } = await getTreasureHuntData(serverId, roleId);
if (!activityData) {
return resResult(STATUS.ACTIVITY_MISSING, {});
}