聊天:部分配置读表

This commit is contained in:
liangtongchuan
2021-03-23 12:22:41 +08:00
parent 3dbd9ba7bf
commit 470be1a72f
8 changed files with 68 additions and 82 deletions

View File

@@ -15,12 +15,11 @@ import { addItems, handleCost } from "../../../services/rewardService";
import { getFriendPointObject } from "../../../pubUtils/itemUtils";
import { RewardInter } from "../../../pubUtils/interface";
import { FriendPresentLogModel } from '../../../db/FriendPresentLog';
import { HeroModel, HeroType } from "../../../db/Hero";
import { HeroModel } from "../../../db/Hero";
import { EquipModel } from "../../../db/Equip";
import { getPlayerMainAttribute } from "../../../services/pvpService";
import { FRIEND } from "../../../pubUtils/dicParam";
import { PlayerDetail, PlayerDetailHero } from "../../../domain/battleField/guild";
import { PvpDefenseModel } from "../../../db/PvpDefense";
import { createPrivateMsg, pushMsgToRole } from "../../../services/chatService";

View File

@@ -1,5 +1,6 @@
import { CHAT_SYSTEM } from './../pubUtils/dicParam';
import { PrivateChatRec } from './../db/ChatInfo';
import { RoleModel, RoleUpdate } from './../db/Role';
import { RoleModel } from './../db/Role';
import { GroupMessageModel } from './../db/GroupMessage';
import { CounterModel } from './../db/Counter';
import { STATUS } from './../consts/statusCode';
@@ -7,7 +8,7 @@ import { PrivateMessageModel, PrivateMessageParam, PrivateMessageType } from './
import { GroupMessageParam, GroupMessageType } from '../db/GroupMessage';
import { genCode, resResult } from '../pubUtils/util';
import { pinus } from 'pinus';
import { CHANNEL_PREFIX, MSG_CODE_LEN, MSG_STATUS, ON_PRIVATE_MSG_ROUTE, RECENT_PRIVATE_CHATS_CNT, RECENT_GROUP_MSGS_CNT, MSG_TYPE, MSG_SOURCE } from '../consts';
import { CHANNEL_PREFIX, MSG_CODE_LEN, MSG_STATUS, ON_PRIVATE_MSG_ROUTE, MSG_TYPE, MSG_SOURCE } from '../consts';
import { getRoleOnlineInfo } from './redisService';
import { ChatInfoModel } from '../db/ChatInfo';
import { channelServer } from './chatChannelService';
@@ -172,7 +173,7 @@ function sendFromRole(msg: GroupMessageParam) {
* @returns
*/
async function recentGroupMsgs(roomId: string, count?: number) {
const msgs = await GroupMessageModel.getMsgs(roomId, Infinity, count || RECENT_GROUP_MSGS_CNT);
const msgs = await GroupMessageModel.getMsgs(roomId, Infinity, count || CHAT_SYSTEM.RECENT_GROUP_MSGS_CNT);
const roleIds = msgs
.map(msg => { return sendFromRole(msg) ? msg.roleId : null })
.filter(roleId => !!roleId);
@@ -281,7 +282,7 @@ export async function recentPrivateChatInfos(roleId: string, roleName: string) {
const { recentPrivateChats } = await roleChatInfos(roleId, roleName);
recentPrivateChats
.sort((a, b) => a.lastChatTime.getTime() - b.lastChatTime.getTime())
.splice(RECENT_PRIVATE_CHATS_CNT);
.splice(CHAT_SYSTEM.RECENT_PRIVATE_CHATS_CNT);
if (!recentPrivateChats || !recentPrivateChats.length) return null;
const roleInfos = await RoleModel.findRoleByField('roleId', recentPrivateChats.map(chat => { return chat.targetRoleId }));

View File

@@ -1,6 +1,4 @@
export const MSG_CODE_LEN = 8;
export const RECENT_PRIVATE_CHATS_CNT = 20;
export const RECENT_GROUP_MSGS_CNT = 10;
export const MAX_PRIVATE_MSGS = 99;
export const JEWEL_PUSH_LV = 7;
@@ -44,6 +42,10 @@ export const MSG_SOURCE = {
MYSTERY_FIRST_SUC: 16,
VESTIGE_FIRST_SUC: 17,
TEAM_INVITE: 18,
HERO_WAKEUP: 19,
EQUIP_REFRESH_BEST: 20,
ACQUIRE_RARE_GOODS: 21,
GROUP_SEND_GIFT: 22,
}
export const ON_PRIVATE_MSG_ROUTE = 'onPrivateMessage';
@@ -52,73 +54,3 @@ export const ON_ADD_CHANNEL_ROUTE = 'onAddChannel';
export const ON_LEAVE_CHANNEL_ROUTE = 'onLeaveChannel';
export const DEFAULT_MSG_PER_PAGE = 10;
// 要放到策划表里的数据
export const RICH_TEXT_TABLE = [
{
id: 0,
jumpTo: '',
color: '#000000',
type: 'default'
},
{
id: 2,
jumpTo: 'hero',
color: '#ff0000',
type: 'hero'
},
{
id: 3,
jumpTo: 'equip',
color: '#112233',
type: 'equip'
},
{
id: 4,
jumpTo: 'refine',
color: '#aabbcc',
type: 'equip'
},
{
id: 5,
jumpTo: 'recurit',
color: '#aa0000',
type: 'link'
},
{
id: 6,
jumpTo: 'compose',
color: '#00aa00',
type: 'link'
}
];
export const BUBBLE_TABLE = [{
id: 1,
imgUrl: 'a.jpg',
name: '金牛'
}, {
id: 2,
imgUrl: 'b.jpg',
name: '白羊'
}];
export const SYS_EMOJI = [{
id: 1,
name: '大笑',
imgUrl: 'laugh.jpg',
group: 'zhaoyun',
index: 1
}, {
id: 2,
name: '大哭',
imgUrl: 'cry.jpg',
group: 'zhaoyun',
index: 2
}, {
id: 3,
name: '生气',
imgUrl: 'angry.jpg',
group: 'xiahou',
index: 1
}];

View File

@@ -348,7 +348,9 @@ export const FILENAME = {
DIC_GUILD_ACTIVITY: 'dic_zyz_guildActivity',
DIC_GATE_ACTIVITY_POINT: 'dic_zyz_gateActivityPoint',
DIC_GUILD_AUCTION: 'dic_zyz_guildAuction',
DIC_CITY_ACTIVITY: 'dic_zyz_cityActivity'
DIC_CITY_ACTIVITY: 'dic_zyz_cityActivity',
DIC_CHAT_ACCUSE: 'dic_zyz_chat_report',
DIC_CHAT_SYSTEM: 'dic_zyz_chat_system',
}
export const WAR_RELATE_TABLES = [

View File

@@ -63,6 +63,7 @@ import { dicGateActivityPoint } from './dictionary/DicGateActivityPoint';
import { dicGuildAuction } from './dictionary/DicGuildAuction';
import { getCutDay } from "./timeUtil";
import { dicCityActivity } from "./dictionary/DicCityActivity";
import { dicChatAccuse } from "./dictionary/DicChatAccuse";
export const gameData = {
blurprtCompose: dicBlueprtCompose,
@@ -148,7 +149,8 @@ export const gameData = {
guildActivity: dicGuildActivity,
gateActivityPoint: dicGateActivityPoint,
guildAuction: dicGuildAuction,
cityActivity: dicCityActivity
cityActivity: dicCityActivity,
chatAccuse: dicChatAccuse,
};
// 在此提供一些原先在gamedata中提供的方法以便更方便获取gameData数据

View File

@@ -80,10 +80,9 @@ export const HTTPMANAGE = {
ADDRESSTYPE: 1, // 1开发服2审核服3版号服
SERVERTYPE: 1, // ADDRESSTYPE下服务器的筛选1开发服2玩家服
};
export const SYSTEAM = {
export const CHAT_SYSTEM = {
RECENT_GROUP_MSGS_CNT: 10, // 群消息获取条数
RECENT_PRIVATE_CHATS_CNT: 20, // 最近私聊个数
MSG_TYPE: 0, // 0纯文本1副文本2表情
};
export const GUILDACTIVITY = {
GATEACTIVITY_CHALLENGE_TIMES: 1, // 蛮夷入侵每天可以挑战次的次数
@@ -100,3 +99,12 @@ export const GUILDACTIVITY = {
GATEACTIVITY_BOSS_DIFFICULT: '1&1.2|2&1.5', // boss类型&难度系数|boss类型&难度系数1小boss,2:大boss)
RACEACTIVITY_DURABILITY_REWARD: 2, // 每剩余1%耐久度给予X点功勋
};
export const GUILDAUCTION = {
DIVIDENDRATE: 1, // 分红比例1表示总金额 100% 分红
DIVIDENDWEEKENDRATE: 0.2, // 额外分红,周末加成,0.2表示周围额外加成 20% 分红
AUCTION_PRICE_RISE: 1.1, // 单次竞价价格上涨幅度1.1表示竞拍每次价格上涨10%
AUCTION_BOSSEXPECT_MAX: 1000, // 演武台预期分红上限
AUCTION_BOSSEXPECT_MIN: 200, // 演武台预期分红下限
AUCTION_ACTIVITYEXPECT_MAX: 2000, // 军团活动预期分红上限
AUCTION_ACTIVITYEXPECT_MIN: 500, // 军团活动预期分红下限
};

View File

@@ -0,0 +1,21 @@
// 聊天举报表
import { readJsonFile } from '../util'
import { FILENAME } from '../../consts'
export interface DicChatAccuse {
// 举报 id
readonly id: number;
// 举报名称
readonly name: string;
}
const str = readJsonFile(FILENAME.DIC_CHAT_ACCUSE);
let arr = JSON.parse(str);
export const dicChatAccuse = new Map<number, DicChatAccuse>();
arr.forEach(o => {
dicChatAccuse.set(o.id, o);
});
arr = undefined;

View File

@@ -0,0 +1,21 @@
// 聊天模板表
import { readJsonFile } from '../util'
import { FILENAME } from '../../consts'
export interface DicChatSystem {
// 模板 id
readonly id: number;
// 模板名称
readonly name: string;
}
const str = readJsonFile(FILENAME.DIC_CHAT_SYSTEM);
let arr = JSON.parse(str);
export const dicChatSystem = new Map<number, DicChatSystem>();
arr.forEach(o => {
dicChatSystem.set(o.id, o);
});
arr = undefined;