diff --git a/game-server/app/services/connectorService.ts b/game-server/app/services/connectorService.ts index 0141034e8..18f119180 100644 --- a/game-server/app/services/connectorService.ts +++ b/game-server/app/services/connectorService.ts @@ -205,7 +205,7 @@ async function getModuleData(type: string, data: { role: RoleType, session: Fron case 'chapter': return getMainChapter(role); case 'survey': - return await getSurvey(role.roleId); + return await getSurvey(role.roleId, role.lv); default: return null; } diff --git a/game-server/app/services/gmService.ts b/game-server/app/services/gmService.ts index a8f0a5365..ceb0a6765 100644 --- a/game-server/app/services/gmService.ts +++ b/game-server/app/services/gmService.ts @@ -340,8 +340,8 @@ export async function getParamStr(activity: ActivityModelType, productID: string } -export async function getSurvey(roleId: string) { - let surveys = await SurveyModel.findEnableSurvey(SURVEY_SELECT.FIND); +export async function getSurvey(roleId: string, lv: number) { + let surveys = await SurveyModel.findEnableSurvey(lv, SURVEY_SELECT.FIND); let recs = await SurveyRecModel.findByRole(roleId); return surveys.filter(survey => { let index = recs.findIndex(rec => rec.surveyId == survey.surveyId); diff --git a/shared/db/Survery.ts b/shared/db/Survery.ts index 272b8afaf..d82329105 100644 --- a/shared/db/Survery.ts +++ b/shared/db/Survery.ts @@ -42,8 +42,8 @@ export default class Survey extends BaseModel { @prop({ required: true }) isEnable: boolean; // 是否显示 - public static async findEnableSurvey(select = '') { - let rec: SurveyType[] = await SurveyModel.find({ isEnable: true, endTime: { $gte: nowSeconds() } }).select(select).lean(); + public static async findEnableSurvey(lv: number, select = '') { + let rec: SurveyType[] = await SurveyModel.find({ isEnable: true, lv: { $lte: lv }, startTime: { $lte: nowSeconds() }, endTime: { $gte: nowSeconds() } }).select(select).lean(); return rec; }