活动:寻宝骑兵活动接口
This commit is contained in:
@@ -7,6 +7,7 @@ import { addReward, stringToRewardParam, useGiftPackage } from '../../../service
|
||||
import { ActivityFirstGiftModel } from '../../../db/ActivityFirstGift';
|
||||
import { signInActivity, signInVIPActivity } from '../../../services/signInService';
|
||||
import { growthFundActivity } from '../../../services/growthFundService';
|
||||
import { newPlayerLimitPackageActivity } from '../../../services/limitPackageService';
|
||||
|
||||
export default function (app: Application) {
|
||||
return new ActivityHandler(app);
|
||||
@@ -129,7 +130,17 @@ export class ActivityHandler {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//新手限定RMB购买礼包
|
||||
{
|
||||
let data = await newPlayerLimitPackageActivity(serverId, roleId);
|
||||
if (data) {
|
||||
playerActivityArray.push({
|
||||
type: ACTIVITY_TYPE.NEW_PLAYER_LIMIT_PACKAGE,
|
||||
activityId: data.activityId,
|
||||
data,
|
||||
});
|
||||
}
|
||||
}
|
||||
return resResult(STATUS.SUCCESS, { playerActivityArray });
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
import { Application, BackendSession } from 'pinus';
|
||||
import { resResult } from '../../../pubUtils/util';
|
||||
import { STATUS, ACTIVITY_RESOURCES_TYPE, ACTIVITY_TYPE } from '../../../consts';
|
||||
import { getPlayerTreasureHuntData, getTreasureHuntData } from '../../../services/treasureHuntService';
|
||||
|
||||
|
||||
export default function (app: Application) {
|
||||
return new TreasureHuntHandler(app);
|
||||
}
|
||||
|
||||
export class TreasureHuntHandler {
|
||||
constructor(private app: Application) {
|
||||
}
|
||||
|
||||
/************************寻宝骑兵活动****************************/
|
||||
|
||||
/**
|
||||
* @description 获取寻宝骑兵活动的数据
|
||||
* @param {BackendSession} session
|
||||
* @memberof TreasureHuntHandler
|
||||
*/
|
||||
async getTreasureHuntActivity(msg: { activityId: number }, session: BackendSession) {
|
||||
const { activityId } = msg;
|
||||
const roleId = session.get('roleId');
|
||||
const serverId = session.get('serverId');
|
||||
let { huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex, activityData } = await getTreasureHuntData(serverId);
|
||||
if (!activityData) {
|
||||
return resResult(STATUS.ACTIVITY_MISSING, {});
|
||||
}
|
||||
let playerData = await getPlayerTreasureHuntData(activityId, serverId, roleId, huntRoundIndex, huntBeginTime, huntEndTime);
|
||||
if (!playerData) return resResult(STATUS.ACTIVITY_MISSING);
|
||||
|
||||
return resResult(STATUS.SUCCESS, playerData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 寻宝骑兵购买每日商店中的商品
|
||||
* @param {BackendSession} session
|
||||
* @memberof TreasureHuntHandler
|
||||
*/
|
||||
async buyGoods(msg: { activityId: number }, session: BackendSession) {
|
||||
const { activityId } = msg;
|
||||
const roleId = session.get('roleId');
|
||||
const serverId = session.get('serverId');
|
||||
let { huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex, activityData } = await getTreasureHuntData(serverId);
|
||||
if (!activityData) {
|
||||
return resResult(STATUS.ACTIVITY_MISSING, {});
|
||||
}
|
||||
if (activityId !== huntActivityId) {
|
||||
return resResult(STATUS.ACTIVITY_MISSING, {});
|
||||
}
|
||||
|
||||
let playerData = await getPlayerTreasureHuntData(activityId, serverId, roleId, huntRoundIndex, huntBeginTime, huntEndTime,);
|
||||
if (!playerData) return resResult(STATUS.ACTIVITY_MISSING);
|
||||
|
||||
return resResult(STATUS.SUCCESS, playerData);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user