38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import { ActivityModel, ActivityModelType } from '../db/Activity';
|
|
import { ActivitySevenDaysModel, ActivitySevenDaysModelType } from '../db/ActivitySevenDays';
|
|
import { SevenDaysData } from '../domain/activityField/sevenDaysField';
|
|
|
|
/**
|
|
* 获取活动数据
|
|
*
|
|
* @param {number} serverId 区Id
|
|
* @param {number} activityId 活动Id
|
|
* @param {string} roleId 角色Id
|
|
*
|
|
*/
|
|
export async function getActivityData(activityId: number, serverId: number, roleId: string) {
|
|
let activityData: ActivityModelType = await ActivityModel.findActivity(activityId, true);
|
|
return { data: activityData };
|
|
}
|
|
|
|
/**
|
|
* 玩家活动数据
|
|
*
|
|
* @param {number} serverId 区Id
|
|
* @param {number} activityId 活动Id
|
|
* @param {string} roleId 角色Id
|
|
*
|
|
*/
|
|
export async function getPlayerData(activityId: number, serverId: number, roleId: string) {
|
|
let activityData: ActivityModelType = await ActivityModel.findActivity(activityId, true);
|
|
let playerRecords: ActivitySevenDaysModelType[] = await ActivitySevenDaysModel.findData(activityId, roleId);
|
|
|
|
let playerData = new SevenDaysData(activityData);
|
|
playerData.setPlayerRecords(playerRecords);
|
|
|
|
return { data: playerData };
|
|
}
|
|
|
|
|
|
|