sdk: 根据37要求修改问题
This commit is contained in:
@@ -3,7 +3,7 @@ import {Application, RouteRecord, FrontendOrBackendSession, HandlerCallback, pin
|
|||||||
import { refresh } from '../../../services/refreshService';
|
import { refresh } from '../../../services/refreshService';
|
||||||
import { checkPrivateChat, checkGuildChat, checkOtherChat, checkRoleName, checkGuildName } from "../../../services/sdkService";
|
import { checkPrivateChat, checkGuildChat, checkOtherChat, checkRoleName, checkGuildName } from "../../../services/sdkService";
|
||||||
import { resResult, checkWhiteListWithUid, genCode } from "../../../pubUtils/util";
|
import { resResult, checkWhiteListWithUid, genCode } from "../../../pubUtils/util";
|
||||||
import { CHANNEL_PREFIX, STATUS } from "../../../consts";
|
import { CHANNEL_PREFIX, MSG_TYPE, STATUS } from "../../../consts";
|
||||||
import { UserModel } from "../../../db/User";
|
import { UserModel } from "../../../db/User";
|
||||||
import { SERVER_DEBUG_MODE } from "../../../pubUtils/dicParam";
|
import { SERVER_DEBUG_MODE } from "../../../pubUtils/dicParam";
|
||||||
export function globalFilter(app: Application) {
|
export function globalFilter(app: Application) {
|
||||||
@@ -46,12 +46,14 @@ Filter.prototype.before = async function (routeRecord: RouteRecord, msg: any, se
|
|||||||
switch(routeRecord.route) {
|
switch(routeRecord.route) {
|
||||||
case 'chat.chatHandler.sendPrivateMessage':
|
case 'chat.chatHandler.sendPrivateMessage':
|
||||||
{
|
{
|
||||||
|
if(msg.type == MSG_TYPE.IMG) break;
|
||||||
let result = await checkPrivateChat(roleId, msg.targetRoleId, msg.content);
|
let result = await checkPrivateChat(roleId, msg.targetRoleId, msg.content);
|
||||||
if(!result) hasBlockWords = true;
|
if(!result) hasBlockWords = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'chat.chatHandler.sendGroupMessage':
|
case 'chat.chatHandler.sendGroupMessage':
|
||||||
{
|
{
|
||||||
|
if(msg.type == MSG_TYPE.IMG) break;
|
||||||
if(msg.channel == CHANNEL_PREFIX.GUILD) {
|
if(msg.channel == CHANNEL_PREFIX.GUILD) {
|
||||||
let result = await checkGuildChat(roleId, guildCode, msg.content);
|
let result = await checkGuildChat(roleId, guildCode, msg.content);
|
||||||
if(!result) hasBlockWords = true;
|
if(!result) hasBlockWords = true;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import { getActivities } from '../../../services/activity/activityService';
|
|||||||
import * as dicParam from '../../../pubUtils/dicParam';
|
import * as dicParam from '../../../pubUtils/dicParam';
|
||||||
import Counter from '../../../db/Counter';
|
import Counter from '../../../db/Counter';
|
||||||
import { UserModel } from '../../../db/User';
|
import { UserModel } from '../../../db/User';
|
||||||
import { checkFilterWords, reportTAEvent } from '../../../services/sdkService';
|
import { checkFilterWords, reportTAEvent, treatRoleName } from '../../../services/sdkService';
|
||||||
|
|
||||||
export default function (app: Application) {
|
export default function (app: Application) {
|
||||||
new HandlerService(app, {});
|
new HandlerService(app, {});
|
||||||
@@ -614,4 +614,16 @@ export class RoleHandler {
|
|||||||
return resResult(STATUS.SUCCESS);
|
return resResult(STATUS.SUCCESS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async debugTreatRoleName(msg: { magicWord: string }, session: BackendSession) {
|
||||||
|
let roleId: string = session.get('roleId');
|
||||||
|
|
||||||
|
let { magicWord } = msg;
|
||||||
|
if (magicWord !== DEBUG_MAGIC_WORD) {
|
||||||
|
return resResult(STATUS.TOKEN_ERR);
|
||||||
|
}
|
||||||
|
|
||||||
|
await treatRoleName(roleId, true);
|
||||||
|
return resResult(STATUS.SUCCESS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { GuildModel } from "../db/Guild";
|
|||||||
import { getRoleOnlineInfo, updateUserInfo } from "./redisService";
|
import { getRoleOnlineInfo, updateUserInfo } from "./redisService";
|
||||||
import { Application, pinus } from "pinus";
|
import { Application, pinus } from "pinus";
|
||||||
import { getGuildChannelSid } from "./chatService";
|
import { getGuildChannelSid } from "./chatService";
|
||||||
import { getRandSingleEelm, readWordTxt, writeWordTxt } from "../pubUtils/util";
|
import { getRandSingleEelm, readWordTxt, resResult, writeWordTxt } from "../pubUtils/util";
|
||||||
const ThinkingAnalytics = require("thinkingdata-node");
|
const ThinkingAnalytics = require("thinkingdata-node");
|
||||||
import Trie from '../pubUtils/trie';
|
import Trie from '../pubUtils/trie';
|
||||||
import _ = require("underscore");
|
import _ = require("underscore");
|
||||||
@@ -99,9 +99,9 @@ export async function checkGuildName(guildCode: string, serverId: number, name:
|
|||||||
|
|
||||||
|
|
||||||
// 根据37sdk处理违规玩家名
|
// 根据37sdk处理违规玩家名
|
||||||
export async function treatRoleName(roleId: string) {
|
export async function treatRoleName(roleId: string, isDebug?: boolean) {
|
||||||
let role = await RoleModel.findByRoleId(roleId);
|
let role = await RoleModel.findByRoleId(roleId);
|
||||||
if(role && role.sdkMark) { // 有设置标记的情况下
|
if((role && role.sdkMark) || isDebug) { // 有设置标记的情况下
|
||||||
let newName = "默认玩家名";
|
let newName = "默认玩家名";
|
||||||
// 新名字上传
|
// 新名字上传
|
||||||
await checkRoleName(roleId, newName, role);
|
await checkRoleName(roleId, newName, role);
|
||||||
@@ -112,6 +112,9 @@ export async function treatRoleName(roleId: string) {
|
|||||||
const { sid } = await getRoleOnlineInfo(roleId);
|
const { sid } = await getRoleOnlineInfo(roleId);
|
||||||
if(!!sid) {
|
if(!!sid) {
|
||||||
await pinus.app.rpc.connector.connectorRemote.setOtherUserRoleNameSession.toServer(sid,[{ roleId, roleName: newName }]); // 改session
|
await pinus.app.rpc.connector.connectorRemote.setOtherUserRoleNameSession.toServer(sid,[{ roleId, roleName: newName }]); // 改session
|
||||||
|
pinus.app.get('channelService').pushMessageByUids('onPlayerDataChange', resResult(STATUS.SUCCESS, {
|
||||||
|
roleName: newName
|
||||||
|
}), [{uid: roleId, sid}]);
|
||||||
}
|
}
|
||||||
// 补偿
|
// 补偿
|
||||||
let gold = getGoldObject(NAMEPLATE.NAMEPLATE_FEECOST)
|
let gold = getGoldObject(NAMEPLATE.NAMEPLATE_FEECOST)
|
||||||
|
|||||||
@@ -83,7 +83,9 @@ module.exports = {
|
|||||||
'optional uInt32 giftGold': 2,
|
'optional uInt32 giftGold': 2,
|
||||||
'optional uInt32 gold': 3,
|
'optional uInt32 gold': 3,
|
||||||
'optional uInt32 ap': 4,
|
'optional uInt32 ap': 4,
|
||||||
'optional uInt32 totalPay': 5
|
'optional uInt32 totalPay': 5,
|
||||||
|
'optional uInt32 totalCost': 6,
|
||||||
|
'optional string roleName': 7,
|
||||||
},
|
},
|
||||||
'required string msg': 1,
|
'required string msg': 1,
|
||||||
'required uInt32 code': 2,
|
'required uInt32 code': 2,
|
||||||
|
|||||||
@@ -309,7 +309,7 @@ export default class Auth extends Service {
|
|||||||
const code = ctx.service.utils.genCode(6);
|
const code = ctx.service.utils.genCode(6);
|
||||||
const seqId = await Counter.getNewCounter(COUNTER.ROLE) || -1;
|
const seqId = await Counter.getNewCounter(COUNTER.ROLE) || -1;
|
||||||
|
|
||||||
const role = await RoleModel.createRole(uid, serverId, { roleId, code, roleName: roleId, seqId, lv: DEFAULT_LV, exp: (getExpByLv(DEFAULT_LV - 1) || { sum: 0 }).sum || 0 });
|
const role = await RoleModel.createRole(uid, serverId, { roleId, code, roleName: "", seqId, lv: DEFAULT_LV, exp: (getExpByLv(DEFAULT_LV - 1) || { sum: 0 }).sum || 0 });
|
||||||
if (role) {
|
if (role) {
|
||||||
// 任务
|
// 任务
|
||||||
await checkTask(roleId, TASK_TYPE.ROLE_LV, role.lv, false, {});
|
await checkTask(roleId, TASK_TYPE.ROLE_LV, role.lv, false, {});
|
||||||
|
|||||||
Reference in New Issue
Block a user