api/src/Topxia/Api/Resource/Classrooms.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace Topxia\Api\Resource;

use Silex\Application;
use Symfony\Component\HttpFoundation\Request;

class Classrooms extends BaseResource
{
    public function discoveryColumn(Application $app, Request $request)
    {
        $defaultQuery = array(
            'orderType' => '',
            'showCount' => ''
        );

        $result     = array_merge($defaultQuery, $request->query->all());
        $conditions = array();
        if ($result['categoryId']) {
            $childrenIds               = $this->getCategoryService()->findCategoryChildrenIds($result['categoryId']);
            $conditions['categoryIds'] = array_merge(array($result['categoryId']), $childrenIds);
        }

        if ($result['orderType'] == 'hot') {
            $orderBy = 'studentNum';
        } elseif ($result['orderType'] == 'recommend') {
            $orderBy                   = 'recommendedSeq';
            $conditions['recommended'] = 1;
        } else {
            $orderBy = 'createdTime';
        }
        if (empty($result['showCount'])) {
            $result['showCount'] = 6;
        }

        $conditions['status']   = 'published';
        $conditions['showable'] = 1;
        $classrooms             = $this->getClassroomService()->searchClassrooms($conditions, array($orderBy=> 'DESC'), 0, $result['showCount']);

        $total      = count($classrooms);
        $classrooms = $this->filter($classrooms);

        return $this->wrap($classrooms, $total);
    }

    public function get(Application $app, Request $request)
    {
    }

    public function post(Application $app, Request $request)
    {
    }

    public function filter($res)
    {
        return $this->multicallFilter('Classroom', $res);
    }

    protected function multicallFilter($name, $res)
    {

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。