<?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; } }