refactor: 重构权限服务类

This commit is contained in:
Ying
2023-07-03 10:08:34 +08:00
parent 8becf0ef36
commit 4e377def8d
42 changed files with 1679 additions and 1524 deletions

View File

@@ -56,20 +56,30 @@ class User extends Validate
/**
* 自定义验证规则
* @param $value
* @return string|bool
* @return bool
* @throws InvalidArgumentException
*/
protected function checkName($value): string|bool
protected function checkName($value): bool
{
$notAllow = saenv('user_reg_notallow');
$notAllow = explode(',', $notAllow);
if (in_array($value, $notAllow)) {
return '用户名不合法!';
return false;
}
return true;
}
public function sceneAdd(): User
{
return $this->only(['nickname', 'pwd', 'email', 'mobile']);
}
public function sceneEdit(): User
{
return $this->only(['nickname', 'email']);
}
public function sceneRegister(): User
{
return $this->only(['nickname', 'pwd']);
@@ -84,4 +94,4 @@ class User extends Validate
{
return $this->only(['mobile', 'captcha']);
}
}
}