mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-26 04:21:27 +08:00
* 计划任务执行路径,周期 * !39 修复课程分类未过滤 * 优化第三方登录,修复注册密码加密问题 * !33 开放登录阶段性合并 * !24 修复添加课时后进入编辑页面500错误
42 lines
841 B
PHP
42 lines
841 B
PHP
<?php
|
|
|
|
namespace App\Validators;
|
|
|
|
use App\Exceptions\BadRequest as BadRequestException;
|
|
use App\Repos\Connect as ConnectRepo;
|
|
|
|
class Connect extends Validator
|
|
{
|
|
|
|
public function checkConnect($id)
|
|
{
|
|
return $this->checkConnectById($id);
|
|
}
|
|
|
|
public function checkConnectById($id)
|
|
{
|
|
$connectRepo = new ConnectRepo();
|
|
|
|
$connect = $connectRepo->findById($id);
|
|
|
|
if (!$connect) {
|
|
throw new BadRequestException('connect.not_found');
|
|
}
|
|
|
|
return $connect;
|
|
}
|
|
|
|
public function checkConnectByOpenId($openId, $provider)
|
|
{
|
|
$connectRepo = new ConnectRepo();
|
|
|
|
$connect = $connectRepo->findByOpenId($openId, $provider);
|
|
|
|
if (!$connect) {
|
|
throw new BadRequestException('connect.not_found');
|
|
}
|
|
|
|
return $connect;
|
|
}
|
|
}
|