SourceTotalController.class.php
1.31 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
50
51
52
53
<?php
/**
* Created by IntelliJ IDEA.
* 积分来源统计
* User: zs_anything
* Date: 2017/08/02
* Time: 下午15:39
*/
namespace Apicp\Controller\Count;
use VcySDK\Integral;
use VcySDK\Service;
class SourceTotalController extends AbstractController
{
public function Index()
{
$miType = I('post.miType', 'mi_type0');
$businessKey = I('post.businessKey');
$beginTotalTime = I('post.beginTotalTime', 0);
$endTotalTime = I('post.endTotalTime', 0);
$cond = [
'mi_type' => $miType,
'businessKey' => $businessKey
];
if ($beginTotalTime > 0) {
$cond['beginTotalTime'] = $beginTotalTime;
}
if ($endTotalTime > 0) {
$cond['endTotalTime'] = $endTotalTime;
}
$sdk = new Integral(Service::instance());
$this->_result = $sdk->sourceTotal($cond);
// 员圈套件化 过滤
foreach ($this->_result as &$row) {
foreach ($row['sourceTotalList'] as $key => $item) {
if (!in_array($item['businessKey'], cfg('INTEGRAL_STRATEGY_RETAIN'))) {
unset($row['sourceTotalList'][$key]);
}
}
$row['sourceTotalList'] = array_values($row['sourceTotalList']);
}
return true;
}
}