Revert "✨ feat(db): 修改role表数据库操作方式"
This reverts commit e39af3649288cc5802739cfe862c818fe56e194e.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/********** 37sdk **********/
|
||||
|
||||
import Role, { RoleType } from "../db/Role";
|
||||
import { RoleModel, RoleType } from "../db/Role";
|
||||
import { Chat37Params, CheckGuild37Params, CheckName37Params, GetWordParam, PostGuild37Params, PostName37Params, PushMsg37Param } from "../domain/sdk";
|
||||
import { sendMailByContent, sendMailToGuildByContent } from './mailService';
|
||||
import { NAMEPLATE } from '../pubUtils/dicParam';
|
||||
@@ -29,11 +29,11 @@ import { GiftCodeDetailModel } from "../db/GiftCodeDetail";
|
||||
|
||||
export async function checkPrivateChat(roleId: string, targetRoleId: string, message: string) {
|
||||
let body = new Chat37Params(message, getSdkChannelId('private'));
|
||||
let myRole = await Role.findByRoleId(roleId);
|
||||
let myRole = await RoleModel.findByRoleId(roleId);
|
||||
let myUser = await UserModel.findUserByUid(myRole.userInfo.uid);
|
||||
if(myUser.channelInfo) {
|
||||
body.setByMyRole(myRole, myUser);
|
||||
let targetRole = await Role.findByRoleId(targetRoleId);
|
||||
let targetRole = await RoleModel.findByRoleId(targetRoleId);
|
||||
let targetUser = await UserModel.findUserByUid(targetRole.userInfo.uid);
|
||||
body.setByTargetRole(targetRole, targetUser);
|
||||
return await request37CheckChat(SDK_37_ADDR.CHECK_CHAT, body, SDK_37_CONST.CHAT_KEY);
|
||||
@@ -43,7 +43,7 @@ export async function checkPrivateChat(roleId: string, targetRoleId: string, mes
|
||||
|
||||
export async function checkGuildChat(roleId: string, guildCode: string, message: string) {
|
||||
let body = new Chat37Params(message, getSdkChannelId(CHANNEL_PREFIX.GUILD));
|
||||
let myRole = await Role.findByRoleId(roleId);
|
||||
let myRole = await RoleModel.findByRoleId(roleId);
|
||||
let myUser = await UserModel.findUserByUid(myRole.userInfo.uid);
|
||||
if(myUser.channelInfo) {
|
||||
body.setByMyRole(myRole, myUser);
|
||||
@@ -55,7 +55,7 @@ export async function checkGuildChat(roleId: string, guildCode: string, message:
|
||||
|
||||
export async function checkOtherChat(roleId: string, channelPrefix: string, message: string) {
|
||||
let body = new Chat37Params(message, getSdkChannelId(channelPrefix));
|
||||
let myRole = await Role.findByRoleId(roleId);
|
||||
let myRole = await RoleModel.findByRoleId(roleId);
|
||||
let myUser = await UserModel.findUserByUid(myRole.userInfo.uid);
|
||||
if(!!myUser.channelInfo) {
|
||||
body.setByMyRole(myRole, myUser);
|
||||
@@ -66,7 +66,7 @@ export async function checkOtherChat(roleId: string, channelPrefix: string, mess
|
||||
|
||||
export async function checkRoleName(roleId: string, roleName: string, myRole?: RoleType) {
|
||||
if(!myRole) {
|
||||
myRole = await Role.findByRoleId(roleId);
|
||||
myRole = await RoleModel.findByRoleId(roleId);
|
||||
}
|
||||
let myUser = await UserModel.findUserByUid(myRole.userInfo.uid);
|
||||
if(!!myUser.channelInfo) {
|
||||
@@ -111,13 +111,13 @@ export async function checkGuildName(guildCode: string, serverId: number, name:
|
||||
|
||||
// 根据37sdk处理违规玩家名
|
||||
export async function treatRoleName(roleId: string, isDebug?: boolean) {
|
||||
let role = await Role.findByRoleId(roleId);
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
if((role && role.sdkMark) || isDebug) { // 有设置标记的情况下
|
||||
let newName = "默认玩家名";
|
||||
// 新名字上传
|
||||
await checkRoleName(roleId, newName, role);
|
||||
// 改名字
|
||||
await Role.updateRoleInfo(roleId, { roleName: newName, sdkMark: false });
|
||||
await RoleModel.updateRoleInfo(roleId, { roleName: newName, sdkMark: false });
|
||||
// 通知处理
|
||||
await updateUserInfo(REDIS_KEY.USER_INFO, roleId, [{ field: 'roleName', value: newName }]); // redis缓存
|
||||
if(role.isGuildLeader) {
|
||||
@@ -157,7 +157,7 @@ export async function treatGuildName(content: string) {
|
||||
for(let roleId of guild.members) {
|
||||
await updateUserInfo(REDIS_KEY.USER_INFO, roleId, [{ field: 'guildName', value: newName }]);
|
||||
}
|
||||
await Role.updateGuildName(params.code, newName);
|
||||
await RoleModel.updateGuildName(params.code, newName);
|
||||
|
||||
} else if (params.type == 2) { // 公会公告
|
||||
await checkGuildName(params.code, params.serverId, undefined, ' ');
|
||||
@@ -249,7 +249,7 @@ export function reportTAUserSet(type: TA_USERSET_TYPE, roleId: string, propertie
|
||||
export async function reportCreateRoleEventToTa(role: RoleType, ip: string) {
|
||||
if(role.shushuMark) {
|
||||
reportTAEvent(role.roleId, TA_EVENT.CREATE_ROLE, null, ip, role.shushuMark);
|
||||
await Role.updateRoleInfo(role.roleId, { shushuMark: '' });
|
||||
await RoleModel.updateRoleInfo(role.roleId, { shushuMark: '' });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user