feat(活动): 节日活动高级签到邮件补发

This commit is contained in:
luying
2023-08-04 16:20:36 +08:00
parent 822c8c8c42
commit 3d510783da
8 changed files with 90 additions and 3 deletions

View File

@@ -75,6 +75,7 @@ export enum MAIL_TYPE {
MONTHLY_FUND = 45, // 补发月基金奖励
ARTIFACT_OVER = 46, // 宝物数量超过
GVG_BATTLE_PLAYER_SETTLE_RANK_REWARD = 47, // 激战期个人占领排行榜奖励
REPAIRE_SIGN_IN = 48, // 高级签到补发奖励
};
export const SEND_NAME = '系统';

View File

@@ -1,7 +1,7 @@
import BaseModel from './BaseModel';
import { index, getModelForClass, prop, DocumentType, ReturnModelType, mongoose } from '@typegoose/typegoose';
import { CounterAllModal } from './CounterAll';
import { COUNTER } from '../consts';
import { ACTIVITY_TIME_TYPE, COUNTER } from '../consts';
import { ActivityGroupModel } from './ActivityGroup';
import { UpdateActivityParam } from '../domain/backEndField/params';
@@ -90,6 +90,12 @@ export default class Activity extends BaseModel {
return result;
}
// 查询
public static async findOpenTypeByTime(type: number) {
let result: ActivityModelType[] = await ActivityModel.find({ type, isEnable: true, timeType: ACTIVITY_TIME_TYPE.DATE_TIME, beginTime: { $lte: new Date }, endTime: { $gte: new Date() } }).lean();
return result;
}
//debug测试用接口
public static async debugFindActivityByType(type: number) {
let result: ActivityModelType[] = await ActivityModel.findOne({ type }).lean(true);

View File

@@ -27,6 +27,8 @@ export default class Activity_Sign_In extends BaseModel {
roundIndex: number; // 周期数,从活动设置的开始时间计算
@prop({ required: true, type: Activity_Sign_In_Record, _id: false })
records: Activity_Sign_In_Record[]; // 领取记录
@prop({ required: false })
hasRepair: boolean; // 是否补发了
//签到记录
public static async addSignInRecord(activityId: number, roleId: string, roundIndex: number, dayIndex: number) {
@@ -48,6 +50,16 @@ export default class Activity_Sign_In extends BaseModel {
return result;
}
// 根据活动id查询记录
public static async findByActivity(activityId: number, roundIndex: number) {
let result: ActivitySignInModelType[] = await ActivitySignInModel.find({ activityId, roundIndex }).lean();
return result;
}
public static async repairSignIn(activityId: number, roleIds: string[]) {
await ActivitySignInModel.updateMany({ activityId, roleId: { $in: roleIds } }, { $set: { hasRepair: true } });
}
//删除签到记录
public static async deleteActivity(activityId: number, roleId: string, roundIndex: number) {
await ActivitySignInModel.deleteMany({ roleId, activityId, roundIndex });

View File

@@ -334,5 +334,12 @@
"sendName": "学宫驿使",
"content": "亲爱的百家传人,逐鹿中原激战期内,您在积分上为联军做出重要贡献,荣获第%d名奖励现已发送至邮箱请查收",
"time": 720
},
{
"id": 48,
"title": "&",
"sendName": "学宫驿使",
"content": "亲爱的百家传人,您在本期集会活动中有高级签到的奖励未领取,现发送至邮箱,请查收",
"time": 2160
}
]