1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-28 05:11:39 +08:00

1.Response增加unauthorized响应

2.open_avatar字段增加长度为255
3.清理无用的代码
This commit is contained in:
xiaochong0302 2024-03-13 08:57:55 +08:00
parent 739ed46822
commit e711a3ef50
5 changed files with 15 additions and 18 deletions

View File

@ -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\ConsultList as ConsultListService;
use App\Services\Logic\Chapter\Learning as LearningService;
use App\Services\Logic\Chapter\ResourceList as ResourceListService;
/**
* @RoutePrefix("/api/chapter")
@ -44,18 +43,6 @@ class ChapterController extends Controller
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")
*/
@ -73,6 +60,10 @@ class ChapterController extends Controller
$this->notFound();
}
if ($chapter['me']['logged'] == 0) {
$this->unauthorized();
}
if ($chapter['me']['owned'] == 0) {
$this->forbidden();
}

View File

@ -92,7 +92,7 @@
<div class="course-meta wrap">
<div class="cover">
<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 class="info">
{% if course.model == 1 %}

View File

@ -50,7 +50,7 @@ class ChapterVod extends Service
$result = [];
foreach ($vod->file_transcode as $key => $file) {
foreach ($vod->file_transcode as $file) {
$file['url'] = $vodService->getPlayUrl($file['url']);
$type = $this->getDefinitionType($file['height']);
$result[$type] = $file;

View File

@ -9,14 +9,20 @@ namespace App\Traits;
use App\Exceptions\Forbidden as ForbiddenException;
use App\Exceptions\NotFound as NotFoundException;
use Phalcon\Config;
use Phalcon\Di;
use App\Exceptions\Unauthorized as UnauthorizedException;
use Phalcon\Config as Config;
use Phalcon\Di as Di;
use Phalcon\Http\Request as HttpRequest;
use Phalcon\Http\Response as HttpResponse;
trait Response
{
public function unauthorized()
{
throw new UnauthorizedException('sys.unauthorized');
}
public function forbidden()
{
throw new ForbiddenException('sys.forbidden');

View File

@ -1869,7 +1869,7 @@ final class V20210324064239 extends AbstractMigration
->addColumn('open_avatar', 'string', [
'null' => false,
'default' => '',
'limit' => 150,
'limit' => 255,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'comment' => '开放头像',