This commit is contained in:
luying
2022-04-02 17:43:12 +08:00
parent f50c32079c
commit 89744aeb13
11 changed files with 193 additions and 7 deletions
+16 -1
View File
@@ -11,11 +11,13 @@ import { GuildModel } from "../db/Guild";
import { getRoleOnlineInfo, updateUserInfo } from "./redisService";
import { Application, pinus } from "pinus";
import { getGuildChannelSid } from "./chatService";
import { getRandSingleEelm, readWordTxt, resResult, writeWordTxt } from "../pubUtils/util";
import { getRandSingleEelm, parseGoodStr, readWordTxt, resResult, writeWordTxt } from "../pubUtils/util";
const ThinkingAnalytics = require("thinkingdata-node");
import Trie from '../pubUtils/trie';
import _ = require("underscore");
import { getGoldObject } from "./role/rewardService";
import { SurveyRecModel } from "../db/SurveyRec";
import { SurveyModel } from "../db/Survery";
// 检查私聊是否合法
@@ -283,4 +285,17 @@ export async function checkFilterWords(word: string) {
let server = getRandSingleEelm(servers);
return await pinus.app.rpc.chat.chatRemote.checkFilterWords.toServer(server.id, word);
}
}
export async function sendSurveyMail(code: string) {
let rec = await SurveyRecModel.findByCode(code);
if(!rec || rec.hasSentMail) return false;
let survey = await SurveyModel.findBySurveyId(rec.surveyId);
if(!survey) return false;
let reward = parseGoodStr(survey.reward);
await sendMailByContent(MAIL_TYPE.SEND_MAIL, rec.roleId, { goods: reward, params: [survey.mailContent] });
rec = await SurveyRecModel.send(rec.code);
}