dbms_init...1
This commit is contained in:
parent
ae7b636afb
commit
18b412e7a4
@ -64,23 +64,22 @@ class Home extends AdminController
|
|||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Index,FieldForm관련
|
//Index,FieldForm관련
|
||||||
public function index(): RedirectResponse|string
|
public function index(): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->initAction(__FUNCTION__);
|
$this->initAction(__FUNCTION__);
|
||||||
//최근 inverval(default : 7일)일간 신규서버 정보
|
//Total 서버 현황
|
||||||
|
$this->totalCounts = $this->getService()->getTotalCountsByType();
|
||||||
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
||||||
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
||||||
$this->setFilterFieldOption($item_type, $this->getService()->getFilterOptionsByItemType($item_type));
|
$this->setFilterFieldOption($item_type, $this->getService()->getFilterOptionsByItemType($item_type));
|
||||||
}
|
}
|
||||||
|
//interval을 기준으로 최근 신규 서비스정보 가져오기
|
||||||
$this->interval = intval($this->request->getVar('interval') ?? SERVICE_NEW_INTERVAL);
|
$this->interval = intval($this->request->getVar('interval') ?? SERVICE_NEW_INTERVAL);
|
||||||
$entities = [];
|
$this->newServiceEntities = $this->getService()->getEntitiesByNewService($this->interval);
|
||||||
foreach ($this->getService()->getEntitiesByNewService($this->interval) as $entity) {
|
$this->newServiceCount = count($this->newServiceEntities);
|
||||||
$entities[$entity->getPK()] = $this->getService()->setItemEntitiesByService($entity);
|
|
||||||
}
|
|
||||||
$this->newServiceEntities = $entities;
|
|
||||||
$this->newServiceCount = count($this->newServiceEntities);
|
|
||||||
|
|
||||||
//미납 서버 정보
|
//미납 서버 정보
|
||||||
$this->unPaidEntities = $this->getServicePaymentService()->getEntitiesByUnPaid();
|
$this->unPaidEntities = $this->getServicePaymentService()->getEntitiesByUnPaid();
|
||||||
$this->unPaidCount = count($this->unPaidEntities);
|
$this->unPaidCount = count($this->unPaidEntities);
|
||||||
|
|||||||
@ -138,16 +138,45 @@ class ServiceService extends CustomerService
|
|||||||
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
||||||
$entity->setItemEntities(
|
$entity->setItemEntities(
|
||||||
$item_type,
|
$item_type,
|
||||||
$this->getServiceItemService()->getEntities(['serviceinfo_uid' => $entity->getPK(), 'item_type' => $item_type])
|
$this->getServiceItemService()->getEntities([
|
||||||
|
'serviceinfo_uid' => $entity->getPK(),
|
||||||
|
'item_type' => $item_type
|
||||||
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
//interval을 기준으로 신규서비스 가져오기
|
//interval을 기준으로 최근 신규 서비스정보 가져오기
|
||||||
final public function getEntitiesByNewService(int $interval, string $status = DEFAULTS['STATUS'])
|
final public function getEntitiesByNewService(int $interval, string $status = DEFAULTS['STATUS']): array
|
||||||
{
|
{
|
||||||
$where = sprintf("start_at >= NOW()-INTERVAL {$interval} DAY AND status = '%s'", DEFAULTS['STATUS']);
|
$where = sprintf("start_at >= NOW()-INTERVAL {$interval} DAY AND status = '%s'", $status);
|
||||||
return $this->getEntities($where);
|
$entities = [];
|
||||||
|
foreach ($this->getEntities($where) as $entity) {
|
||||||
|
$entities[$entity->getPK()] = $this->setItemEntitiesByService($entity);
|
||||||
|
};
|
||||||
|
return $entities;
|
||||||
|
}
|
||||||
|
//서비스 방식에 따른 서비스별 Count
|
||||||
|
final public function getTotalCountsByType(): array
|
||||||
|
{
|
||||||
|
$sql = "SELECT type,
|
||||||
|
COUNT(CASE WHEN location = 'default' THEN 1 END) AS chiba,
|
||||||
|
COUNT(CASE WHEN location = 'tokyo' THEN 1 END) AS tokyo,
|
||||||
|
COUNT(CASE WHEN location IN ('default', 'tokyo') THEN 1 END) AS total
|
||||||
|
FROM serviceinfo GROUP BY type;";
|
||||||
|
|
||||||
|
$totalCounts = ['chiba_total' => 0, 'tokyo_total' => 0, 'all_total' => 0];
|
||||||
|
foreach ($this->getModel()->query($sql)->getResult() as $row) {
|
||||||
|
$totalCounts[$row->type] = [
|
||||||
|
'chiba' => $row->chiba,
|
||||||
|
'tokyo' => $row->tokyo,
|
||||||
|
'total' => $row->total,
|
||||||
|
];
|
||||||
|
$totalCounts['chiba_total'] += $row->chiba;
|
||||||
|
$totalCounts['tokyo_total'] += $row->tokyo;
|
||||||
|
}
|
||||||
|
$totalCounts['all_total'] = $totalCounts['chiba_total'] + $totalCounts['tokyo_total'];
|
||||||
|
return $totalCounts;
|
||||||
}
|
}
|
||||||
//다음 달로 결제일을 연장합니다.
|
//다음 달로 결제일을 연장합니다.
|
||||||
final public function extendBillingAt(string $billing_at, string $status): bool
|
final public function extendBillingAt(string $billing_at, string $status): bool
|
||||||
|
|||||||
@ -14,10 +14,10 @@
|
|||||||
<!-- Layout Right Start -->
|
<!-- Layout Right Start -->
|
||||||
<?= $this->include("templates/{$viewDatas['layout']}/welcome_banner"); ?>
|
<?= $this->include("templates/{$viewDatas['layout']}/welcome_banner"); ?>
|
||||||
<div class="row align-items-start" style="padding-top:20px;">
|
<div class="row align-items-start" style="padding-top:20px;">
|
||||||
<div class="col-5">
|
<div class="col-7">
|
||||||
<?= $this->include("templates/{$viewDatas['layout']}/welcome_total"); ?>
|
<?= $this->include("templates/{$viewDatas['layout']}/welcome_total"); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-7">
|
<div class="col-5">
|
||||||
<?= $this->include("templates/{$viewDatas['layout']}/welcome_new"); ?>
|
<?= $this->include("templates/{$viewDatas['layout']}/welcome_new"); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
<th colspan="2">방어</th>
|
<th colspan="2">방어</th>
|
||||||
<th colspan="2">전용</th>
|
<th colspan="2">전용</th>
|
||||||
<th colspan="2">대체</th>
|
<th colspan="2">대체</th>
|
||||||
<th colspan="2">테스트</th>
|
<th colspan="3">테스트</th>
|
||||||
<th colspan="3">합계</th>
|
<th colspan="3">합계</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -30,6 +30,7 @@
|
|||||||
<th>치바</th>
|
<th>치바</th>
|
||||||
<th>도쿄</th>
|
<th>도쿄</th>
|
||||||
<th>치바</th>
|
<th>치바</th>
|
||||||
|
<th>합계</th>
|
||||||
<th>도쿄</th>
|
<th>도쿄</th>
|
||||||
<th>치바</th>
|
<th>치바</th>
|
||||||
<th>합계</th>
|
<th>합계</th>
|
||||||
@ -37,68 +38,21 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>prime</td>
|
<td>PRIME</td>
|
||||||
<td>4</td>
|
<td><?= $viewDatas['totalCounts']['default']['tokyo'] ?></td>
|
||||||
<td>192</td>
|
<td><?= $viewDatas['totalCounts']['default']['chiba'] ?></td>
|
||||||
<td>0</td>
|
<td><?= $viewDatas['totalCounts']['defence']['tokyo'] ?></td>
|
||||||
<td>0</td>
|
<td><?= $viewDatas['totalCounts']['defence']['chiba'] ?></td>
|
||||||
<td>0</td>
|
<td><?= $viewDatas['totalCounts']['dedicated']['tokyo'] ?></td>
|
||||||
<td>12</td>
|
<td><?= $viewDatas['totalCounts']['dedicated']['chiba'] ?></td>
|
||||||
<td>0</td>
|
<td><?= $viewDatas['totalCounts']['alternative']['tokyo'] ?></td>
|
||||||
<td>0</td>
|
<td><?= $viewDatas['totalCounts']['alternative']['chiba'] ?></td>
|
||||||
<td>3</td>
|
<td><?= $viewDatas['totalCounts']['test']['tokyo'] ?></td>
|
||||||
<td>3</td>
|
<td><?= $viewDatas['totalCounts']['test']['chiba'] ?></td>
|
||||||
<td>4</td>
|
<td><?= $viewDatas['totalCounts']['test']['total'] ?></td>
|
||||||
<td>204</td>
|
<td><?= $viewDatas['totalCounts']['tokyo_total'] ?></td>
|
||||||
<td>208</td>
|
<td><?= $viewDatas['totalCounts']['chiba_total'] ?></td>
|
||||||
</tr>
|
<td><?= $viewDatas['totalCounts']['all_total'] ?></td>
|
||||||
<tr>
|
|
||||||
<td>itsolution</td>
|
|
||||||
<td>10</td>
|
|
||||||
<td>206</td>
|
|
||||||
<td>6</td>
|
|
||||||
<td>0</td>
|
|
||||||
<td>0</td>
|
|
||||||
<td>0</td>
|
|
||||||
<td>0</td>
|
|
||||||
<td>0</td>
|
|
||||||
<td>1</td>
|
|
||||||
<td>1</td>
|
|
||||||
<td>16</td>
|
|
||||||
<td>206</td>
|
|
||||||
<td>222</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>gdidc</td>
|
|
||||||
<td>5</td>
|
|
||||||
<td>38</td>
|
|
||||||
<td>0</td>
|
|
||||||
<td>0</td>
|
|
||||||
<td>0</td>
|
|
||||||
<td>7</td>
|
|
||||||
<td>0</td>
|
|
||||||
<td>0</td>
|
|
||||||
<td>3</td>
|
|
||||||
<td>3</td>
|
|
||||||
<td>5</td>
|
|
||||||
<td>45</td>
|
|
||||||
<td>50</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>gamewing</td>
|
|
||||||
<td>12</td>
|
|
||||||
<td>121</td>
|
|
||||||
<td>0</td>
|
|
||||||
<td>0</td>
|
|
||||||
<td>0</td>
|
|
||||||
<td>0</td>
|
|
||||||
<td>0</td>
|
|
||||||
<td>0</td>
|
|
||||||
<td>0</td>
|
|
||||||
<td>0</td>
|
|
||||||
<td>12</td>
|
|
||||||
<td>121</td>
|
|
||||||
<td>133</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot class="table-light fw-bold">
|
<tfoot class="table-light fw-bold">
|
||||||
@ -112,6 +66,7 @@
|
|||||||
<td>19</td>
|
<td>19</td>
|
||||||
<td>0</td>
|
<td>0</td>
|
||||||
<td>0</td>
|
<td>0</td>
|
||||||
|
<td>0</td>
|
||||||
<td>7</td>
|
<td>7</td>
|
||||||
<td>7</td>
|
<td>7</td>
|
||||||
<td>37</td>
|
<td>37</td>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user