EpInfoController.class.php
1.55 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
54
55
<?php
/**
* 首页 企业信息
* Created by PhpStorm.
* User: zhoutao
* Date: 2017/10/24
* Time: 下午3:15
*/
namespace Apicp\Controller\HomePage;
use Common\Common\Cache;
use Common\Common\Order;
use VcySDK\Member;
use VcySDK\Service;
use VcySDK\Enterprise;
class EpInfoController extends AbstractController
{
public function index()
{
// 企业配置
$cache = new Cache();
$epConfig = $cache->get('Common.EnterpriseConfig');
// 企业人数
$memberSdk = new Member(Service::instance());
$memberStatus = $memberSdk->memberStatusCount([]);
// 企业信息
$sdk = new Enterprise(Service::instance());
$epDetail = $sdk->detail();
// 企业内的人数,evUsedUserTotal是昨天的使用人数,更新为实时人数
$epDetail['evUsedUserTotalDelay'] = $epDetail['evUsedUserTotal'];
$epDetail['evUsedUserTotal'] = $memberStatus['amount'];
// 付费计算
$paymentInfo = Order::instance()->checkThePayment();
// 业绩比拼计算
$saleInfo = Order::instance()->checkTheSale("performancerankings");
// 圆圈应用计算
$yuanquan = Order::instance()->checkTheSale("yuanquan");
$paymentInfo = array_merge($paymentInfo, $saleInfo,$yuanquan);
$this->_result = [
'corpId' => $epConfig['wxqyCorpid'],
'memberStatus' => $memberStatus,
'enterpriseInfo' => $epDetail,
'paymentInfo' => !empty($paymentInfo) ? $paymentInfo : [],
];
return true;
}
}