推送:对单人推送函数抽象
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { RoleModel, RoleType } from '../../db/Role';
|
||||
import { pinus, FrontendOrBackendSession } from 'pinus';
|
||||
import { resResult, shouldRefresh } from '../../pubUtils/util';
|
||||
import { STATUS, TASK_TYPE, TASK_FUN_TYPE, SHOP_REFRESH_TYPE, WAR_TYPE } from '../../consts';
|
||||
import { STATUS, TASK_TYPE, TASK_FUN_TYPE, SHOP_REFRESH_TYPE, WAR_TYPE, PUSH_ROUTE } from '../../consts';
|
||||
import { TaskParamInter, TaskListReturn } from '../../domain/roleField/task';
|
||||
import { EPlace, HeroType } from '../../db/Hero';
|
||||
import { HeroScores } from '../../db/PvpHistoryOpp';
|
||||
@@ -17,6 +17,7 @@ import { CheckTask } from './taskObj';
|
||||
import { getEquipById } from '../equipService';
|
||||
import { JewelType } from '../../db/Jewel';
|
||||
import { checkPopUpConditionInCreateHero } from '../activity/popUpShopService';
|
||||
import { sendMessageToUserWithSuc } from '../pushService';
|
||||
|
||||
export async function checkTaskWithRoles(serverId: number, roleId: string, sid: string, taskType: TASK_TYPE, roles: RoleType[]) {
|
||||
for (let role of roles) {
|
||||
@@ -354,10 +355,7 @@ export async function refDailyTask(roleId: string, sid: string) {
|
||||
|
||||
// 转移每日任务
|
||||
await removeHistoryTask(roleId, TASK_FUN_TYPE.DAILY);
|
||||
|
||||
let uids = [{ uid: roleId, sid }];
|
||||
pinus.app.get('channelService').pushMessageByUids('onDailyTaskRefresh', resResult(STATUS.SUCCESS, { taskList }), uids);
|
||||
|
||||
sendMessageToUserWithSuc(roleId, PUSH_ROUTE.DAILY_TASK_REFRESH, { taskList }, sid);
|
||||
}
|
||||
|
||||
export async function removeHistoryTask(roleId: string, type: number, today?: Date) {
|
||||
@@ -375,10 +373,6 @@ export async function refDailyTaskBox(roleId: string, sid: string, debug = false
|
||||
let userTask = await UserTaskModel.refreshWeekly(roleId, debug);
|
||||
if (userTask) {
|
||||
let { dailyTaskPoint: point, dailyTaskPointWeekly: weeklyPoint, dailyTaskBox: box } = userTask;
|
||||
let uids = [{ uid: roleId, sid }];
|
||||
pinus.app.get('channelService').pushMessageByUids('onTaskBoxRefresh', resResult(STATUS.SUCCESS, {
|
||||
type: TASK_FUN_TYPE.DAILY,
|
||||
point, weeklyPoint, box
|
||||
}), uids);
|
||||
sendMessageToUserWithSuc(roleId, PUSH_ROUTE.TASK_BOX_REFRESH, { type: TASK_FUN_TYPE.DAILY, point, weeklyPoint, box }, sid);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user