mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-07-13 11:59:11 +08:00
34 lines
794 B
PHP
34 lines
794 B
PHP
<?php
|
|
|
|
namespace App\Validators;
|
|
|
|
use App\Exceptions\BadRequest as BadRequestException;
|
|
use App\Repos\ImChatGroupUser as ImChatGroupUserRepo;
|
|
|
|
class ImChatGroupUser extends Validator
|
|
{
|
|
|
|
public function checkIfJoined($userId, $groupId)
|
|
{
|
|
$repo = new ImChatGroupUserRepo();
|
|
|
|
$record = $repo->findGroupUser($userId, $groupId);
|
|
|
|
if ($record && $record->blocked == 0) {
|
|
throw new BadRequestException('im_chat_group_user.has_joined');
|
|
}
|
|
}
|
|
|
|
public function checkIfBlocked($userId, $groupId)
|
|
{
|
|
$repo = new ImChatGroupUserRepo();
|
|
|
|
$record = $repo->findGroupUser($userId, $groupId);
|
|
|
|
if ($record && $record->blocked == 1) {
|
|
throw new BadRequestException('im_chat_group_user.blocked');
|
|
}
|
|
}
|
|
|
|
}
|