mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-28 21:31:37 +08:00
1.Response增加unauthorized响应
2.open_avatar字段增加长度为255 3.清理无用的代码
This commit is contained in:
parent
739ed46822
commit
e711a3ef50
@ -12,7 +12,6 @@ use App\Services\Logic\Chapter\ChapterLike as ChapterLikeService;
|
|||||||
use App\Services\Logic\Chapter\CommentList as CommentListService;
|
use App\Services\Logic\Chapter\CommentList as CommentListService;
|
||||||
use App\Services\Logic\Chapter\ConsultList as ConsultListService;
|
use App\Services\Logic\Chapter\ConsultList as ConsultListService;
|
||||||
use App\Services\Logic\Chapter\Learning as LearningService;
|
use App\Services\Logic\Chapter\Learning as LearningService;
|
||||||
use App\Services\Logic\Chapter\ResourceList as ResourceListService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @RoutePrefix("/api/chapter")
|
* @RoutePrefix("/api/chapter")
|
||||||
@ -44,18 +43,6 @@ class ChapterController extends Controller
|
|||||||
return $this->jsonPaginate($pager);
|
return $this->jsonPaginate($pager);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @Get("/{id:[0-9]+}/resources", name="api.chapter.resourses")
|
|
||||||
*/
|
|
||||||
public function resourcesAction($id)
|
|
||||||
{
|
|
||||||
$service = new ResourceListService();
|
|
||||||
|
|
||||||
$resources = $service->handle($id);
|
|
||||||
|
|
||||||
return $this->jsonSuccess(['resources' => $resources]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Get("/{id:[0-9]+}/info", name="api.chapter.info")
|
* @Get("/{id:[0-9]+}/info", name="api.chapter.info")
|
||||||
*/
|
*/
|
||||||
@ -73,6 +60,10 @@ class ChapterController extends Controller
|
|||||||
$this->notFound();
|
$this->notFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($chapter['me']['logged'] == 0) {
|
||||||
|
$this->unauthorized();
|
||||||
|
}
|
||||||
|
|
||||||
if ($chapter['me']['owned'] == 0) {
|
if ($chapter['me']['owned'] == 0) {
|
||||||
$this->forbidden();
|
$this->forbidden();
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@
|
|||||||
<div class="course-meta wrap">
|
<div class="course-meta wrap">
|
||||||
<div class="cover">
|
<div class="cover">
|
||||||
<span class="model layui-badge layui-bg-green">{{ model_type(course.model) }}</span>
|
<span class="model layui-badge layui-bg-green">{{ model_type(course.model) }}</span>
|
||||||
<img src="{{ course.cover }}" alt="{{ course.title }}">
|
<img src="{{ course.cover }}!cover_270" alt="{{ course.title }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
{% if course.model == 1 %}
|
{% if course.model == 1 %}
|
||||||
|
@ -50,7 +50,7 @@ class ChapterVod extends Service
|
|||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
foreach ($vod->file_transcode as $key => $file) {
|
foreach ($vod->file_transcode as $file) {
|
||||||
$file['url'] = $vodService->getPlayUrl($file['url']);
|
$file['url'] = $vodService->getPlayUrl($file['url']);
|
||||||
$type = $this->getDefinitionType($file['height']);
|
$type = $this->getDefinitionType($file['height']);
|
||||||
$result[$type] = $file;
|
$result[$type] = $file;
|
||||||
|
@ -9,14 +9,20 @@ namespace App\Traits;
|
|||||||
|
|
||||||
use App\Exceptions\Forbidden as ForbiddenException;
|
use App\Exceptions\Forbidden as ForbiddenException;
|
||||||
use App\Exceptions\NotFound as NotFoundException;
|
use App\Exceptions\NotFound as NotFoundException;
|
||||||
use Phalcon\Config;
|
use App\Exceptions\Unauthorized as UnauthorizedException;
|
||||||
use Phalcon\Di;
|
use Phalcon\Config as Config;
|
||||||
|
use Phalcon\Di as Di;
|
||||||
use Phalcon\Http\Request as HttpRequest;
|
use Phalcon\Http\Request as HttpRequest;
|
||||||
use Phalcon\Http\Response as HttpResponse;
|
use Phalcon\Http\Response as HttpResponse;
|
||||||
|
|
||||||
trait Response
|
trait Response
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public function unauthorized()
|
||||||
|
{
|
||||||
|
throw new UnauthorizedException('sys.unauthorized');
|
||||||
|
}
|
||||||
|
|
||||||
public function forbidden()
|
public function forbidden()
|
||||||
{
|
{
|
||||||
throw new ForbiddenException('sys.forbidden');
|
throw new ForbiddenException('sys.forbidden');
|
||||||
|
@ -1869,7 +1869,7 @@ final class V20210324064239 extends AbstractMigration
|
|||||||
->addColumn('open_avatar', 'string', [
|
->addColumn('open_avatar', 'string', [
|
||||||
'null' => false,
|
'null' => false,
|
||||||
'default' => '',
|
'default' => '',
|
||||||
'limit' => 150,
|
'limit' => 255,
|
||||||
'collation' => 'utf8mb4_general_ci',
|
'collation' => 'utf8mb4_general_ci',
|
||||||
'encoding' => 'utf8mb4',
|
'encoding' => 'utf8mb4',
|
||||||
'comment' => '开放头像',
|
'comment' => '开放头像',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user