fix:更新已知bug,优化代码

This commit is contained in:
Ying
2022-11-28 19:11:12 +08:00
parent f6aee95cfc
commit 9445b206a2
1378 changed files with 53759 additions and 20789 deletions

View File

@@ -4,6 +4,10 @@ declare(strict_types=1);
namespace app\common\validate\system;
use Psr\SimpleCache\InvalidArgumentException;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\Validate;
class User extends Validate
@@ -37,22 +41,25 @@ class User extends Validate
// 测试验证场景
protected $scene = [
'test' => ['test_filed'],
'test' => ['test_filed'],
'nickname' => ['nickname'],
];
/**
* 自定义验证规则
* @param $value
* @return bool
* @throws InvalidArgumentException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
protected function filters($value): bool
{
$notAllow = saenv('user_reg_notallow');
$notAllow = explode(',', $notAllow);
foreach ($notAllow as $values) {
if ($value == $values) {
return false;
}
if (in_array($value, $notAllow)) {
return false;
}
return true;
}