ClassController.class.php 1.5 KB
<?php
/**
 * ClassController.class.php
 * 收藏类型列表
 * @author Deepseath
 * @version $Id$
 */

namespace Api\Controller\Collection;

use Common\Service\CommonCollectionService;

class ClassController extends AbstractController
{
    protected $_app_list = [
            'activity' => '员圈活动',
            'course' => '课程中心',
            'exam' => '考试中心',
            'answer' => '问答中心',
            'doc' => '资料库',
            'live' => '员圈直播',
            'news' => '员圈头条',
            'workmate' => '同事圈',
            'questionnaire' => '培训调研',
            'train' => '企业培训',
            'task' => '员圈任务',
            'sale' => '业绩比拼',
            'teacher' => '企业讲师',
            'map' => '学习地图'
    ];

    /**
     * 获取收藏分类列表
     * @return bool
     */
    public function Index()
    {

        // 排序参数
        $order_option = ['c_time' => 'DESC'];

        $collectionService = new CommonCollectionService();

        // 获取列表
        $data = $collectionService->list_by_conds(['uid'=>$this->uid], null, $order_option, 'distinct(app_dir) AS app');

        $list=[];

        foreach ($data as $value){
            $list[]=[
                'app'=>$value['app'],
                'name'=>$this->_app_list[strtolower($value['app'])]
            ];
        }

        // 返回数据
        $this->_result = array(
            'list' => $list,
        );

        return true;
    }
}