加密后的代码
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

ChatValidate.php 550B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace app\kefuapi\validate;
  3. use app\common\basics\Validate;
  4. use app\common\model\user\User;
  5. class ChatValidate extends Validate
  6. {
  7. protected $rule = [
  8. 'user_id' => 'require|checkUser',
  9. ];
  10. protected $message = [
  11. 'user_id.require' => '参数缺失',
  12. ];
  13. protected function checkUser($value, $rule, $data=[])
  14. {
  15. $user = User::where(['id' => $value])->findOrEmpty();
  16. if ($user->isEmpty() || $user['del']) {
  17. return '用户不存在';
  18. }
  19. return true;
  20. }
  21. }