拍卖行:添加实时推送
This commit is contained in:
@@ -12,7 +12,7 @@ import { participants } from './guildActivityService';
|
||||
import { Member } from '../domain/battleField/guildActivity';
|
||||
import * as dicParam from '../pubUtils/dicParam';
|
||||
import { RewardInter } from '../pubUtils/interface';
|
||||
import { pushCurrentTime } from './chatService';
|
||||
import { getGuildAuctionChannelSid, getWorldAuctionChannelSid, pushCurrentTime } from './chatService';
|
||||
|
||||
// ! 获取底价,假数据
|
||||
export function getBasePrice(gid: number, count: number) {
|
||||
@@ -385,7 +385,7 @@ export async function sendUngotDividend(debug = false) {
|
||||
|
||||
for (let [roleId, count] of rewards) {
|
||||
// TODO: 邮件类型修改
|
||||
await sendMailByContent(MAIL_TYPE.GUILD_BOSS_REWARD, roleId, {
|
||||
await sendMailByContent(MAIL_TYPE.GUILD_DIVIDEND, roleId, {
|
||||
params: [JSON.stringify(count)],
|
||||
goods: [{ id: CURRENCY_BY_TYPE.get(CURRENCY_TYPE.GOLD), count }]
|
||||
});
|
||||
@@ -414,4 +414,14 @@ export async function getAuction(guildCode: string, session: FrontendOrBackendSe
|
||||
dividends = await DividendModel.findGuildDividendsByBegin(guildCode, begin);
|
||||
}
|
||||
return { lots, dividends };
|
||||
}
|
||||
|
||||
export async function pushAuctionOver(lot: LotType) {
|
||||
if(lot.auctionStage == AUCTION_STAGE.GUILD) {
|
||||
let chatSid = await getGuildAuctionChannelSid(lot.guildCode);
|
||||
pinus.app.rpc.chat.chatRemote.sendGuildAuction.toServer(chatSid, lot.guildCode, lot);
|
||||
} else if (lot.auctionStage == AUCTION_STAGE.WORLD) {
|
||||
let chatSid = await getWorldAuctionChannelSid(lot.serverId);
|
||||
pinus.app.rpc.chat.chatRemote.sendWorldAuction.toServer(chatSid, lot.serverId, lot);
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,16 @@ export async function addRoleToCityChannel(roleId: string, sid: string, cityId:
|
||||
await addRoleToChannel(roomId, roleId, sid);
|
||||
}
|
||||
|
||||
export async function addRoleToGuildAuctionChannel(roleId: string, sid: string, guildCode: string) {
|
||||
const roomId = groupRoomId(CHANNEL_PREFIX.GUILD_AUCTION, guildCode);
|
||||
await addRoleToChannel(roomId, roleId, sid);
|
||||
}
|
||||
|
||||
export async function addRoleToWorldAuctionChannel(roleId: string, sid: string, serverId: number) {
|
||||
const roomId = groupRoomId(CHANNEL_PREFIX.GUILD_AUCTION, serverId);
|
||||
await addRoleToChannel(roomId, roleId, sid);
|
||||
}
|
||||
|
||||
async function leaveChannel(roomId: string, roleId: string, sid: string) {
|
||||
const channelSid = await channelServer(roomId);
|
||||
await pinus.app.rpc.chat.chatRemote.leaveChannel.toServer(channelSid, roomId, roleId, sid);
|
||||
@@ -66,6 +76,15 @@ export async function leaveCityChannel(roleId: string, sid: string, cityId: numb
|
||||
await leaveChannel(roomId, roleId, sid);
|
||||
}
|
||||
|
||||
export async function leaveGuildAuctionChannel(roleId: string, sid: string, guildCode: string) {
|
||||
const roomId = groupRoomId(CHANNEL_PREFIX.CITY, guildCode);
|
||||
await leaveChannel(roomId, roleId, sid);
|
||||
}
|
||||
|
||||
export async function leaveWorldAuctionChannel(roleId: string, sid: string, serverId: number) {
|
||||
const roomId = groupRoomId(CHANNEL_PREFIX.CITY, serverId);
|
||||
await leaveChannel(roomId, roleId, sid);
|
||||
}
|
||||
|
||||
export async function leaveGuildChannel(roleId: string, sid: string, guildCode: string) {
|
||||
if (!guildCode) return;
|
||||
@@ -89,4 +108,16 @@ export async function getCityChannelSid(cityId: number) {
|
||||
const roomId = groupRoomId(CHANNEL_PREFIX.CITY, cityId);
|
||||
const channelSid = await channelServer(roomId);
|
||||
return channelSid;
|
||||
}
|
||||
|
||||
export async function getGuildAuctionChannelSid(guildCpde: string) {
|
||||
const roomId = groupRoomId(CHANNEL_PREFIX.GUILD_AUCTION, guildCpde);
|
||||
const channelSid = await channelServer(roomId);
|
||||
return channelSid;
|
||||
}
|
||||
|
||||
export async function getWorldAuctionChannelSid(serverId: number) {
|
||||
const roomId = groupRoomId(CHANNEL_PREFIX.CITY, serverId);
|
||||
const channelSid = await channelServer(roomId);
|
||||
return channelSid;
|
||||
}
|
||||
Reference in New Issue
Block a user