✨ 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
+12 -1
View File
@@ -659,7 +659,9 @@ export async function redisSubScribe() {
let treatGuildChannel = getRedisSubChannel(REDIS_KEY.TREAT_GUILD_CHANNEL, env);
let surveyChannel = getRedisSubChannel(REDIS_KEY.SURVEY_CHANNEL, env);
let userChannel = getRedisSubChannel(REDIS_KEY.USER_CHANNEL, env);
await redisClientPub().subscribeAsync(payChannel, treatRoleChannel, treatGuildChannel, refundChannel, surveyChannel, userChannel);
let publicAccountChannel = getRedisSubChannel(REDIS_KEY.PUBLIC_ACCOUNT_GIFT, env);
let sendGiftCodeChannel = getRedisSubChannel(REDIS_KEY.SEND_GIFT_CODE, env);
await redisClientPub().subscribeAsync(payChannel, treatRoleChannel, treatGuildChannel, refundChannel, surveyChannel, userChannel, publicAccountChannel, sendGiftCodeChannel);
redisClientPub().on('message', (channel, message) => {
console.log('**********redisSubScribe*******')
console.log('channel: ', channel, payChannel);
@@ -687,6 +689,15 @@ export async function redisSubScribe() {
} else if(channel == userChannel) {
let [sid, roleId] = (message||'').split('|');
if(!!sid && !!roleId) pinus.app.rpc.connector.connectorRemote.remoteLogin.toServer(sid, roleId);
} else if (channel == publicAccountChannel) {
let servers = pinus.app.getServersByType('activity');
let server = getRandSingleEelm(servers);
pinus.app.rpc.activity.activityRemote.sendPublicAccountGift.toServer(server.id, message);
} else if (channel == sendGiftCodeChannel) {
let servers = pinus.app.getServersByType('role');
let server = getRandSingleEelm(servers);
pinus.app.rpc.role.roleRemote.sendGiftCodeMail.toServer(server.id, message);
}
});
}