Merge branch 'feature/mzl_dev' into develop
# Conflicts: # app/functions.php # config/middleware.php
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace app\common\validate;
|
||||
|
||||
use app\common\model\Corp;
|
||||
use app\common\model\Systems;
|
||||
use app\common\model\User;
|
||||
use think\Validate;
|
||||
@@ -17,7 +18,9 @@ class UserValidate extends Validate
|
||||
'phone' => 'checkMobile|checkPhoneUnique',
|
||||
'email' => 'email|checkEmailUnique',
|
||||
'login_type' => 'require|in:upwd,feishu,qrcode',
|
||||
'system_code' => 'require|checkSystemCode'
|
||||
'system_code' => 'require|checkSystemCode',
|
||||
'corp_abbr' => 'require|checkCorpAbbr',
|
||||
'feishu_code' => 'require|string'
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
@@ -40,12 +43,19 @@ class UserValidate extends Validate
|
||||
'login_type.require' => '请选择登录方式',
|
||||
'login_type.in' => '登录方式不支持',
|
||||
'system_code.require' => '系统码不能为空',
|
||||
'system_code.checkSystemCode' => '系统码不存在或不合法'
|
||||
'system_code.checkSystemCode' => '系统码不存在或不合法',
|
||||
'corp_abbr.require' => '公司标识不能为空',
|
||||
'corp_abbr.checkCorpAbbr' => '公司标识不存在或不合法',
|
||||
'feishu_code.require' => '飞书code不能为空',
|
||||
'feishu_code.string' => '飞书code必须是字符串'
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'upwd_register' => ['name', 'account', 'password', 'confirm_password', 'login_type', 'system_code'],
|
||||
'upwd_login' => ['account', 'password', 'login_type', 'system_code'],
|
||||
'upwd_register' => ['name', 'account', 'password', 'confirm_password'],
|
||||
'feishu_register' => ['feishu_code'],
|
||||
'upwd_login' => ['account' => 'require|checkAccount', 'password'],
|
||||
'feishu_auth' => ['corp_abbr', 'system_code', 'login_type'],
|
||||
'feishu_login' => ['feishu_code']
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -129,4 +139,12 @@ class UserValidate extends Validate
|
||||
{
|
||||
return Systems::where('code', $value)->exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证 corp_abbr 企业标识是否存在
|
||||
*/
|
||||
protected function checkCorpAbbr($value, $rule, $data, $field)
|
||||
{
|
||||
return Corp::where('abbr', $value)->exists();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user