聊天:添加屏蔽

This commit is contained in:
luying
2021-11-10 17:28:11 +08:00
parent b15a9088e8
commit 32fe508625
16 changed files with 260 additions and 54 deletions
+73
View File
@@ -1,4 +1,8 @@
import { prop } from "@typegoose/typegoose";
import { SDK_37_CONST } from "../consts";
import { RoleType } from "../db/Role";
import { UserType } from "../db/User";
import { nowSeconds } from "../pubUtils/timeUtil";
// 37的登录验证返回参数
export class LoginValidateData37 {
@@ -31,6 +35,13 @@ export class LoginValidateData37 {
@prop({ required: true })
unique_realname_id: string; // 用户身份证唯一标识
@prop({ required: true })
childGameId: number; // 子游戏id
@prop({ required: true })
platformAppid: string; // 渠道标识
}
export interface LoginValidataReturn37 {
@@ -56,4 +67,66 @@ export interface PayCallback37Data {
time: number; // 请求时间
ext: string; // 扩展参数
sign: string;
}
export class Chat37Params {
game_key: string;
sid: number; // 游戏区
username: number; // channelInfo.uid
actor: string; // roleName
actor_id: string; // roleId
content: string; // 聊天内容
channel: number; // 世界=1,私聊=2,队伍=3,工会=4
ip: string; // 玩家ip
time: number; // unix时间戳
sign: string;
op: string; // channelInfo.platformAppid
actor_level: number; // 等级
actor_recharge_gold: number; // 元宝
guildid: string = ''; // 公会id
to_username: number|string = ''; // 对方channelInfo.uid
to_actor: string = ''; // 对方roleName
to_actor_id: string = ''; // 对方roleId
to_actor_level: number; // 对方等级
to_actor_recharge_gold: number; // 对方元宝
constructor(content: string, channel: number) {
this.game_key = SDK_37_CONST.GAME_KEY;
this.content = content;
this.channel = channel;
this.time = nowSeconds();
}
setByMyRole(role: RoleType, user: UserType) {
let channelInfo = <LoginValidateData37>user.channelInfo;
this.username = channelInfo.uid;
this.actor = role.roleName;
this.actor_id = role.roleId;
this.ip = user.ip;
this.op = channelInfo.platformAppid;
this.actor_level = role.lv;
this.actor_recharge_gold = role.gold;
this.sid = role.serverId;
}
setByGuild(guildCode: string) {
this.guildid = guildCode;
}
setByTargetRole(role: RoleType, user: UserType) {
let channelInfo = <LoginValidateData37>user.channelInfo;
if(channelInfo) {
this.to_username = channelInfo.uid;
this.to_actor = role.roleName;
this.to_actor_id = role.roleId;
this.to_actor_level = role.lv;
this.to_actor_recharge_gold = role.gold;
}
}
setSign(sign: string) {
this.sign = sign;
}
}