特性:优化注册与改名卡逻辑,在触发敏感词或拦截重名时明确提示具体是触发了哪个词汇
This commit is contained in:
@@ -151,8 +151,15 @@ class ShopService
|
||||
}
|
||||
|
||||
// 不能在黑名单保留期内
|
||||
if (UsernameBlacklist::isReserved($newName)) {
|
||||
return ['ok' => false, 'message' => '该昵称处于保护期,暂时无法使用。'];
|
||||
if ($blockingRecord = UsernameBlacklist::getBlockingRecord($newName)) {
|
||||
$reason = '';
|
||||
if ($blockingRecord->type === 'permanent') {
|
||||
$reason = "(包含敏感词:{$blockingRecord->username})";
|
||||
} else {
|
||||
$reason = '(处于曾用名保护期)';
|
||||
}
|
||||
|
||||
return ['ok' => false, 'message' => "该昵称已被系统禁止使用{$reason}。"];
|
||||
}
|
||||
|
||||
// 查找有效的改名卡记录
|
||||
|
||||
Reference in New Issue
Block a user