api/src/Topxia/Api/Resource/MeCourses.php
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Topxia\Api\Resource;
use Silex\Application;
use AppBundle\Common\ArrayToolkit;
use Symfony\Component\HttpFoundation\Request;
use Biz\Course\Service\Impl\CourseServiceImpl;
use Biz\Course\Service\Impl\CourseSetServiceImpl;
class MeCourses extends BaseResource
{
public function get(Application $app, Request $request)
{
$conditions = $request->query->all();
$start = $request->query->get('start', 0);
$limit = $request->query->get('limit', 10);
$type = $request->query->get('type', '');
$relation = $request->query->get('relation', '');
$user = getCurrentUser();
if ('learning' == $relation) {
$total = $this->getCourseService()->findUserLearningCourseCountNotInClassroom($user['id'], $conditions);
$courses = $this->getCourseService()->findUserLearningCoursesNotInClassroom(
$user['id'],
$start,
$limit,
empty($type) ? array() : array('type' => $type)
);
} elseif ('learned' == $relation) {
$total = $this->getCourseService()->findUserLeanedCourseCount($user['id'], $conditions);
$courses = $this->getCourseService()->findUserLearnedCoursesNotInClassroom(
$user['id'],
$start,
$limit,
empty($type) ? array() : array('type' => $type)
);
} elseif ('learn' == $relation) {
$total = $this->getCourseService()->findUserLearnCourseCountNotInClassroom($user['id'], true, true);
if (empty($type)) {
$coursesAfterColumn = $this->getCourseService()->findUserLearnCoursesNotInClassroom(
$user['id'],
$start,
$limit,
true,
true
);
} else {
$coursesAfterColumn = $this->getCourseService()->findUserLearnCoursesNotInClassroomWithType(
$user['id'],
$type,
$start,
$limit
);
}
$courses = array_values($coursesAfterColumn);
} elseif ('teaching' == $relation) {
$total = $this->getCourseService()->findUserTeachCourseCountNotInClassroom(array('userId' => $user['id']), false);
$courses = $this->getCourseService()->findUserTeachCoursesNotInClassroom(
array(
'userId' => $user['id'],
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。