src/ApiBundle/Api/Resource/Course/CourseThreadPost.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace ApiBundle\Api\Resource\Course;
use ApiBundle\Api\ApiRequest;
use ApiBundle\Api\Resource\AbstractResource;
use ApiBundle\Api\Util\AssetHelper;
use Biz\Common\CommonException;
use AppBundle\Common\ArrayToolkit;
class CourseThreadPost extends AbstractResource
{
public function get(ApiRequest $request, $courseId, $postId)
{
$this->getCourseService()->tryTakeCourse($courseId);
$post = $this->getCourseThreadService()->getPost($courseId, $postId);
$posts = array($post);
if (!empty($posts)) {
$posts = $this->readPosts($courseId, $posts);
}
$posts = $this->addAttachments($posts);
$post = array_shift($posts);
$this->getOCUtil()->single($post, array('userId'));
return $post;
}
public function search(ApiRequest $request, $courseId, $threadId)
{
$this->getCourseService()->tryTakeCourse($courseId);
list($offset, $limit) = $this->getOffsetAndLimit($request);
$afterTime = $request->query->get('afterTime');
$conditions = array(
'threadId' => $threadId,
'createdTime_GE' => $afterTime,
);
$total = $this->getCourseThreadService()->getThreadPostCountByThreadId($threadId);
$posts = $this->getCourseThreadService()->searchThreadPosts(
$conditions,
array(),
$offset,
$limit
);
if (!empty($posts)) {
$posts = $this->readPosts($courseId, $posts);
}
$posts = $this->addAttachments($posts);
$this->getOCUtil()->multiple($posts, array('userId'));
return $this->makePagingObject(array_values($posts), $total, $offset, $limit);
}
public function add(ApiRequest $apiRequest, $courseId, $threadId)
{
$this->getCourseService()->tryTakeCourse($courseId);
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。