InfoController.class.php 1.1 KB
<?php
/**
 * InfoController.class.php
 * 同事圈详情
 * User: heyuelong
 * Date:2017年4月26日18:07:37
 */

namespace Api\Controller\Workmate;

use Common\Common\Constant;
use Common\Model\CircleModel;
use Common\Service\CircleService;

class InfoController extends \Api\Controller\AbstractController
{
    protected $_require_login = false;

    /**
     * 主方法
     * @return boolean
     */
    public function Index_get()
    {
        $id = I('get.id');

        // 如果话题ID不存在
        if (empty($id)) {

            E('_EMPTY_CIRCLE_ID');
        }

        // 实例化话题表
        $service = new CircleService();

        // 获取话题详情
        $info = $service->get_by_conds(
            array(
                'id' => $id,
                'pid' => CircleModel::CIRCLE_PID,
                'type'=>Constant::CIRCLE_NOTE_TYPE
            )
        );

        // 如果话题详情不存在
        if (empty($info)) {

            E('_EMPTY_CIRCLE_INFO');
        }

        // 获取详情格式化后的数据
        $this->_result = $service->format_info($info, $this->uid);
    }
}