CollectionNumController.class.php
1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?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);
}
}