其余文件
This commit is contained in:
29
app/kefuapi/validate/ChatValidate.php
Normal file
29
app/kefuapi/validate/ChatValidate.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\kefuapi\validate;
|
||||
|
||||
use app\common\basics\Validate;
|
||||
use app\common\model\user\User;
|
||||
|
||||
|
||||
class ChatValidate extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'user_id' => 'require|checkUser',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'user_id.require' => '参数缺失',
|
||||
];
|
||||
|
||||
protected function checkUser($value, $rule, $data=[])
|
||||
{
|
||||
$user = User::where(['id' => $value])->findOrEmpty();
|
||||
|
||||
if ($user->isEmpty() || $user['del']) {
|
||||
return '用户不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user