活动:任务接口添加serverId接口
This commit is contained in:
@@ -20,18 +20,18 @@ import { ActivityThirtyDaysModel, ActivityThirtyDaysModelType } from '../db/Acti
|
||||
|
||||
|
||||
|
||||
export async function checkTaskWithRoles(taskType: number, roles: RoleType[], funcs?: number[]) {
|
||||
export async function checkTaskWithRoles(serverId: number, taskType: number, roles: RoleType[], funcs?: number[]) {
|
||||
let pushMessage = new Array<TaskListReturn>();
|
||||
for (let role of roles) {
|
||||
if (role) {
|
||||
let singlePush = await checkTaskWithRole(role.roleId, taskType, role, funcs);
|
||||
let singlePush = await checkTaskWithRole(serverId, role.roleId, taskType, role, funcs);
|
||||
pushMessage.concat(singlePush);
|
||||
}
|
||||
}
|
||||
return pushMessage
|
||||
}
|
||||
|
||||
export async function checkTaskWithRole(roleId: string, taskType: number, role: RoleType, funcs?: number[]) {
|
||||
export async function checkTaskWithRole(serverId: number, roleId: string, taskType: number, role: RoleType, funcs?: number[]) {
|
||||
let pushMessage = new Array<TaskListReturn>();
|
||||
|
||||
if (taskType == TASK_TYPE.LOGIN_SUM) {
|
||||
@@ -39,7 +39,7 @@ export async function checkTaskWithRole(roleId: string, taskType: number, role:
|
||||
if (today > role.loginTime) {
|
||||
pushMessage = await checkTask(roleId, taskType, 1, true, {}, funcs);
|
||||
//成长任务-累计登录游戏天数
|
||||
await accomplishTask(roleId, taskType, 1)
|
||||
await accomplishTask(serverId, roleId, taskType, 1)
|
||||
}
|
||||
}
|
||||
else if (taskType == TASK_TYPE.LOGIN_SERIES) {
|
||||
@@ -481,9 +481,9 @@ function checkRecResult(rec: UserTaskRecType, id: number) {
|
||||
* @param {number} parma 参数
|
||||
*
|
||||
*/
|
||||
export async function accomplishTask(roleId: string, taskType: TASK_TYPE, count: number, parma?: any) {
|
||||
//成长活动统计
|
||||
let allActivity: ActivityModelType[] = await ActivityModel.findOpenActivityByType(ACTIVITY_TYPE.TASK_GROWTH, new Date());
|
||||
export async function accomplishTask(serverId: number, roleId: string, taskType: TASK_TYPE, count: number, parma?: any) {
|
||||
//七天乐-成长活动统计
|
||||
let allActivity: ActivityModelType[] = await ActivityModel.findOpenActivityByType(serverId, ACTIVITY_TYPE.TASK_GROWTH, new Date());
|
||||
for (let activity of allActivity) {
|
||||
let growthActivity = new GrowthData(activity);
|
||||
let taskArray = growthActivity.findTaskByType(taskType);
|
||||
@@ -500,7 +500,7 @@ export async function accomplishTask(roleId: string, taskType: TASK_TYPE, count:
|
||||
}
|
||||
|
||||
//今日挑战统计
|
||||
allActivity = await ActivityModel.findOpenActivityByType(ACTIVITY_TYPE.TASK_DAILY_CHALLENGES, new Date());
|
||||
allActivity = await ActivityModel.findOpenActivityByType(serverId, ACTIVITY_TYPE.TASK_DAILY_CHALLENGES, new Date());
|
||||
for (let activity of allActivity) {
|
||||
let growthActivity = new DailyChallengesData(activity);
|
||||
let taskArray = growthActivity.findTaskByType(taskType, growthActivity.today());
|
||||
@@ -531,7 +531,7 @@ export async function accomplishTask(roleId: string, taskType: TASK_TYPE, count:
|
||||
taskType === TASK_TYPE.EQUIP_QUALITY
|
||||
|
||||
) {
|
||||
allActivity = await ActivityModel.findOpenActivityByType(ACTIVITY_TYPE.THIRTY_DAYS, new Date());
|
||||
allActivity = await ActivityModel.findOpenActivityByType(serverId, ACTIVITY_TYPE.THIRTY_DAYS, new Date());
|
||||
for (let activity of allActivity) {
|
||||
let thirtyDaysActivity = new ThirtyDaysData(activity);
|
||||
let playerRecords: ActivityThirtyDaysModelType[] = await ActivityThirtyDaysModel.findData(activity.serverId, activity.activityId, roleId);
|
||||
|
||||
Reference in New Issue
Block a user