67 lines
2.4 KiB
PHP
67 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace lib\Controllers;
|
|
|
|
use lib\Services\ServiceService;
|
|
|
|
class SiteController extends CommonController
|
|
{
|
|
private ?ServiceService $_service = null;
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
} //
|
|
|
|
public function getService(): ServiceService
|
|
{
|
|
if ($this->_service === null) {
|
|
$this->_service = new ServiceService();
|
|
}
|
|
return $this->_service;
|
|
}
|
|
|
|
public function dashboard()
|
|
{
|
|
// 최근7일 신규서버수
|
|
//예외,service_line = "test","substitution"
|
|
$excepts = ["test", "substitution"];
|
|
$this->day = intval(getenv("SITE_DASHBOARD_DAY") ?? 7);
|
|
$this->newServers = $this->getService()->getNewServerCount($this->day, $excepts);
|
|
// 금일기준 미납서버수
|
|
//예외,service_line = "test","substitution",C012:게임윙,C116:WinIDC,C219:IDC-JP
|
|
$excepts = ["test", "substitution", 'C116', 'C012', 'C219'];
|
|
$this->unPayments = $this->getService()->getUnPaymentCount($excepts);
|
|
return $this->render(__FUNCTION__);
|
|
}
|
|
|
|
//서비스카운팅 , total_counting.php
|
|
public function totalcount(string $sitekey): string
|
|
{
|
|
$this->siteInfo = DBMS_SITEINFOS[$sitekey];
|
|
$this->totalcount = $this->getService()->getTotalCount($this->siteInfo);
|
|
// echo $sitekey;
|
|
// dd($this->siteInfo);
|
|
$summary = array();
|
|
foreach ($this->siteInfo['totalcount_types'] as $type) {
|
|
$summary[$type] = array("Tokyo" => 0, "Chiba" => 0);
|
|
}
|
|
foreach ($this->totalcount as $company => $service) {
|
|
$summary[$company] = array("Tokyo" => 0, "Chiba" => 0);
|
|
foreach ($service as $name => $location) {
|
|
$summary[$company]['Tokyo'] += $location['Tokyo'];
|
|
$summary[$name]['Tokyo'] += $location['Tokyo'];
|
|
$summary[$company]['Chiba'] += $location['Chiba'];
|
|
$summary[$name]['Chiba'] += $location['Chiba'];
|
|
}
|
|
}
|
|
$total = array("Tokyo" => 0, "Chiba" => 0);
|
|
foreach ($this->siteInfo['totalcount_types'] as $type) {
|
|
$total['Tokyo'] += $summary[$type]['Tokyo'];
|
|
$total['Chiba'] += $summary[$type]['Chiba'];
|
|
}
|
|
$this->summary = $summary;
|
|
$this->total = $total;
|
|
return $this->render(__FUNCTION__);
|
|
}
|
|
} //Class
|