53 lines
2.7 KiB
PHP
53 lines
2.7 KiB
PHP
<?php
|
|
|
|
namespace lib\Controllers\Client;
|
|
|
|
use lib\Entities\ClientEntity;
|
|
use lib\Services\ClientService;
|
|
use lib\Services\MemberService;
|
|
|
|
class DashboardController extends ClientController
|
|
{
|
|
public function __construct(array $params = [])
|
|
{
|
|
parent::__construct($params);
|
|
$this->setPath('dashboard');
|
|
} //
|
|
|
|
//서비스카운팅 , total_counting_customer.php
|
|
//CLI 접속방법 : php index.php site/client/totalcount/client_code/코드번호
|
|
//WEB 접속방법 : http://localhost/site/client/totalcount/client_code/코드번호
|
|
public function totalcount()
|
|
{
|
|
//기본적으로 필요한 client_code, member_code, service_code를 설정합니다.
|
|
list($this->client, $this->member, $this->service) = $this->setDefaultRequestData(true);
|
|
//사용자별로 쿠폰정보보기
|
|
if ($this->client instanceof ClientEntity) {
|
|
$this->getServiceService()->getModel()->where('client_code', $this->client->getClientCode());
|
|
}
|
|
//서비스위치별(치바,도쿄등)
|
|
$dashboard = [];
|
|
foreach (DBMS_SERVICE_SWITCHCODE as $district => $switchcodes) {
|
|
$switchcode_begin = $switchcodes['begin'];
|
|
$switchcode_end = $switchcodes['end'];
|
|
$this->getServiceService()->getModel()->where("client_code", "{$this->client->getClientCode()}");
|
|
$this->getServiceService()->getModel()->where("service_sw BETWEEN '{$switchcode_begin}' AND '{$switchcode_end}'");
|
|
$this->getServiceService()->getModel()->where("service_status", "o");
|
|
$this->getServiceService()->getModel()->whereNotIn("service_line", ['solo', 'test', 'event', 'substitution']);
|
|
$dashboard[$district] = $this->getServiceService()->getCount();
|
|
} //foreach
|
|
//서비스라인별(일반,방어,전용,테스트,대체,vpn,event등)
|
|
foreach (DBMS_SERVICE_LINE_ALL as $service_line => $label) {
|
|
$this->getServiceService()->getModel()->where('client_code', $this->client->getClientCode());
|
|
$this->getServiceService()->getModel()->where('service_line', $service_line);
|
|
$dashboard[$service_line] = $this->getServiceService()->getCount("SUM(coupon) as cnt");
|
|
} //foreach
|
|
//서비스상태별(일반,방어만)
|
|
$this->getServiceService()->getModel()->where("client_code", $this->client->getClientCode());
|
|
$this->getServiceService()->getModel()->whereNotIn("service_line", ['solo', 'test', 'event', 'substitution']);
|
|
$dashboard['coupon'] = $this->getServiceService()->getCount("SUM(coupon) as cnt");
|
|
$this->dashboard = $dashboard;
|
|
return $this->render(__FUNCTION__);
|
|
}
|
|
} //Class
|