✨ feat(活动): 微信公众号口令

This commit is contained in:
luying
2023-04-04 10:11:05 +08:00
parent 94b6dca4cc
commit cecd959c00
22 changed files with 441 additions and 43 deletions
+16
View File
@@ -22,6 +22,8 @@ import { sendMessageToUserWithSuc } from "./pushService";
import { GuildLeader } from "../domain/rank";
import { initTaLoggingMode } from "./sdk/ta";
import { DicPushMessage } from "../pubUtils/dictionary/DicPushMessage";
import { GiftCodeModel } from "../db/GiftCode";
import { GiftCodeDetailModel } from "../db/GiftCodeDetail";
// 检查私聊是否合法
@@ -319,4 +321,18 @@ export async function sendSurveyMail(code: string) {
await sendMailByContent(MAIL_TYPE.SEND_MAIL, rec.roleId, { goods: survey.reward, params: [survey.mailContent] });
await sendMessageToUserWithSuc(rec.roleId, PUSH_ROUTE.DELETE_SURVEY, { code: survey.code });
rec = await SurveyRecModel.send(rec.code);
}
export async function sendGiftCodeMail(message: string) {
console.log('***** sendSurveyMail', message);
let [roleId, _giftId] = message.split('|');
let giftId = parseInt(_giftId);
if(isNaN(giftId) || !roleId) return false;
let giftCode = await GiftCodeModel.findByGiftId(giftId);
if(!giftCode) {
console.log('***** sendSurveyMail giftId not found', giftId);
return false;
}
await sendMailByContent(MAIL_TYPE.SEND_MAIL, roleId, { goods: giftCode.goods, params: [''] });
}