feat(cool): 添加敏感词过滤功能
- 引入 go-sensitive-word 敏感词过滤库 - 在全局初始化中加载敏感词库并配置过滤器 - 在创建玩家时应用敏感词过滤,替换不合适的昵称内容
This commit is contained in:
@@ -2,6 +2,7 @@ package controller
|
||||
|
||||
import (
|
||||
"blazing/common/socket/errorcode"
|
||||
"blazing/cool"
|
||||
"blazing/logic/service"
|
||||
"blazing/logic/service/login"
|
||||
blservice "blazing/modules/blazing/service"
|
||||
@@ -10,6 +11,6 @@ import (
|
||||
// 处理命令: 1001
|
||||
func (h *Controller) CreatePlayer(data *login.CreatePlayerInboundInfo, c *service.Conn) (result *login.CreatePlayerOutInfo, err errorcode.ErrorCode) {
|
||||
|
||||
blservice.NewUserService(data.Head.UserID).Reg(data.Nickname, data.Color)
|
||||
blservice.NewUserService(data.Head.UserID).Reg(cool.Filter.Replace(data.Nickname, '*'), data.Color)
|
||||
return result, 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user