问卷:添加等级限制

This commit is contained in:
luying
2022-04-13 15:04:58 +08:00
parent c78b213a01
commit 661a691e98
3 changed files with 5 additions and 5 deletions

View File

@@ -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;
}

View File

@@ -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);