<?php /** * InfoController.class.php * 同事圈话题详情 * Date:2018.6.27 */ namespace Api\Controller\Topic; use Common\Common\Constant; use Common\Service\CircleService; class InfoController extends \Api\Controller\AbstractController { protected $_require_login = false; /** * 主方法 * @return boolean */ public function Index_get() { $cid = I('get.id'); // 话题ID不存在 if (!$cid) { E('_EMPTY_CIRCLE_ID'); } // 实例化话题表 $service = new CircleService(); // 获取话题详情 $info = $service->get_by_conds( array( 'id' => $cid, 'pid' => Constant::CIRCLE_PID, 'type' => Constant::CIRCLE_TOPIC_TYPE, ) ); // 如果话题详情不存在 if (empty($info)) { E('_EMPTY_CIRCLE_INFO'); } // 如果不是发布人员则验证权限 if($this->uid!=$info['uid']){ if(!$this->is_look_topic_auth($this->_login->user,$info)){ E('_ERR_NOT_LOOK_TOPIC_AUTH'); } } // 获取详情格式化后的数据 $this->_result = $service->format_info_topic($info, $this->uid); return true; } }