<?php /** * CollectionStatusController.class.php * 查询收藏状态 RPC 接口 * @author Xtong * @version $Id$ */ namespace Rpc\Controller\Collection; use Common\Service\CommonCollectionService; use Think\Log; /** * 查询收藏状态 RPC 接口 * * @uses 调用方法:\Com\Rpc::phprpc(rpc 接口 url)->invoke(接口方法名, 需要传入的参数数组key-value); */ class CollectionNumController extends AbstractController { /** * 查询收藏人数 * @desc 【RPC】查询收藏人数 * @param mixed app:true 被推荐数据所在应用模块目录标识名 * @param mixed dataId:true 被推荐数据的原始数据 Id * @return boolean */ public function Index() { if (!$this->_checkKeyParams()) { return false; } $collectionService = new CommonCollectionService(); $total = $collectionService->count_by_conds([ 'app_dir' => $this->_params['app'], 'data_id' => $this->_params['dataId'] ]); // Rpc 接口返回参数 $result = array( 'total' => $total ); return json_encode($result); } }