This commit is contained in:
luying
2022-04-11 21:21:22 +08:00
parent c6ebb62c6a
commit cb243421ad
6 changed files with 15 additions and 10 deletions
@@ -205,7 +205,6 @@ async function getModuleData(type: string, data: { role: RoleType, session: Fron
case 'chapter':
return getMainChapter(role);
case 'survey':
console.log('******', role.roleId);
return await getSurvey(role.roleId);
default:
return null;
+6 -4
View File
@@ -31,6 +31,7 @@ import { MonopolyData } from "../domain/activityField/monopolyField";
import { ActivityPopUpShopModel, ActivityPopUpShopModelType } from "../db/ActivityPopUpShop";
import { getActivitiesByType } from "./activity/activityService";
import { SurveyModel } from "../db/Survery";
import { SurveyRecModel } from "../db/SurveyRec";
// —————————————— 跑马灯 —————————————— //
// 初始
@@ -340,9 +341,10 @@ export async function getParamStr(activity: ActivityModelType, productID: string
export async function getSurvey(roleId: string) {
let surveys = await SurveyModel.findEnableSurvey(SURVEY_SELECT.ENTRY);
return surveys.filter(cur => cur.receivedRole?.indexOf(roleId) == -1).map(cur => {
delete cur.receivedRole;
return cur;
let surveys = await SurveyModel.findEnableSurvey(SURVEY_SELECT.FIND);
let recs = await SurveyRecModel.findByRole(roleId);
return surveys.filter(survey => {
let index = recs.findIndex(rec => rec.surveyId == survey.surveyId);
return index == -1
});
}
+4 -1
View File
@@ -286,11 +286,14 @@ export async function checkFilterWords(word: string) {
}
export async function sendSurveyMail(code: string) {
console.log('***** sendSurveyMail', code);
let rec = await SurveyRecModel.findByCode(code);
if(!rec || rec.hasSentMail) return false;
console.log('***** sendSurveyMail hasSentMail', rec.hasSentMail);
let survey = await SurveyModel.receive(rec.surveyId, rec.roleId);
let survey = await SurveyModel.findBySurveyId(rec.surveyId);
if(!survey) return false;
console.log('***** sendSurveyMail survey', survey);
await sendMailByContent(MAIL_TYPE.SEND_MAIL, rec.roleId, { goods: survey.reward, params: [survey.mailContent] });
await sendMessageToUserWithSuc(rec.roleId, PUSH_ROUTE.DELETE_SURVEY, { code: rec.code });