src/ApiBundle/Api/Resource/Course/CourseThread.php
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace ApiBundle\Api\Resource\Course;
use ApiBundle\Api\ApiRequest;
use ApiBundle\Api\Resource\AbstractResource;
use ApiBundle\Api\Util\AssetHelper;
use AppBundle\Common\ArrayToolkit;
use Biz\Common\CommonException;
use Biz\File\UploadFileException;
class CourseThread extends AbstractResource
{
public function get(ApiRequest $request, $courseId, $threadId)
{
$this->getCourseService()->tryTakeCourse($courseId);
$thread = $this->getCourseThreadService()->getThreadByThreadId($threadId);
if ($thread['source'] == 'app') {
$attachments = $this->getUploadFileService()->findUseFilesByTargetTypeAndTargetIdAndType('course.thread', $threadId, 'attachment');
$thread = $this->addAttachments($thread, ArrayToolkit::group($attachments, 'targetId'));
}
if ($thread['source'] == 'web') {
$thread['content'] = $this->filterHtml($thread['content']);
}
if (!empty($thread['videoId'])) {
$file = $this->getUploadFileService()->getFile($thread['videoId']);
$thread['askVideoLength'] = $file['length'];
}
$thread['user'] = $this->getUserService()->getUser($thread['userId']);
$this->getCourseThreadService()->hitThread($courseId, $threadId);
return $thread;
}
public function search(ApiRequest $request, $courseId)
{
$this->getCourseService()->tryTakeCourse($courseId);
$type = $request->query->get('type', 'question');
$keyword = $request->query->get('keyword');
$taskId = $request->query->get('taskId', 0);
$conditions = array(
'courseId' => $courseId,
'type' => $type,
'title' => $keyword,
);
if ($taskId) {
$videoAskTime = $request->query->get('videoAskTime', 0);
$task = $this->getTaskService()->getTask($taskId);
$activity = $this->getActivityService()->getActivity($task['activityId'], true);
if (!isset($activity['ext']['file'])) {
throw UploadFileException::NOTFOUND_FILE();
}
$videoId = $activity['ext']['file']['id'];
$conditions['videoId'] = isset($videoId) ? $videoId : 0;
$conditions['videoAskTime_GE'] = ($videoAskTime - 60) > 0 ? $videoAskTime - 60 : 0;
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。