You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
29
hyhproject/admin/validate/Users.php
Executable file
29
hyhproject/admin/validate/Users.php
Executable file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
namespace wstmart\admin\validate;
|
||||
use think\Validate;
|
||||
use think\Db;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 会员验证器
|
||||
*/
|
||||
class Users extends Validate{
|
||||
protected $rule = [
|
||||
['loginName' ,'require|max:30|checkLoginName:1','请输入账号|账号不能超过10个字符'],
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['loginName'],
|
||||
];
|
||||
|
||||
protected function checkLoginName($value){
|
||||
$where = [];
|
||||
$where['dataFlag'] = 1;
|
||||
$where['loginName'] = $value;
|
||||
if((int)input('userId')>0){
|
||||
$where['userId'] = ['<>',(int)input('post.userId')];
|
||||
}
|
||||
$rs = Db::name('users')->where($where)->count();
|
||||
return ($rs==0)?true:'该登录账号已存在';
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user