getClassName(); } public function getModelClass(): string { return Model::class; } public function getEntityClass(): string { return Entity::class; } public function getEntityByCode(string $value): mixed { $this->getModel()->where("service_code", $value); return $this->getEntity(); } public function getEntitysByIP(string $value): mixed { $this->getModel()->where("service_ip", $value); return $this->getEntity(); } public function getEntitysByCodes(array $values): array { $this->getModel()->whereIn('service_code', $values); return $this->getEntitys(); } public function getNewServerCount(int $day, array $excepts): int|string { $this->getModel()->where("service_open_date > DATE_ADD(now(), INTERVAL -{$day} DAY)"); $this->getModel()->where("service_status", 'o'); $this->getModel()->whereNotIn("service_line", $excepts); $count = $this->getModel()->countAllResults(); // echo __FUNCTION__ . ":" . $this->getModel()->getLastQuery(); return $count; } public function getUnPaymentCount(array $excepts): int|string { $this->getModel()->where("service_payment_date > now()"); $this->getModel()->where("service_status", 'o'); $this->getModel()->whereNotIn("service_line", $excepts); $count = $this->getModel()->countAllResults(); // echo __FUNCTION__ . ":" . $this->getModel()->getLastQuery(); return $count; } private function getTotalCountByDistriction(string $where, string $type, string $switch_code1, string $switch_code2): int { $this->getModel()->where($where); $this->getModel()->where(["service_line" => $type, "service_status" => 'o']); $this->getModel()->where("service_sw BETWEEN '{$switch_code1}' AND '{$switch_code2}'"); $count = $this->getModel()->countAllResults(); // echo "
" . $this->getModel()->getLastQuery(); return $count; } final public function getTotalCount(array $siteinfo): array { $temps = array(); foreach ($siteinfo['totalcount_customers'] as $customer => $where) { $temps[$customer] = []; foreach ($siteinfo['totalcount_types'] as $type) { $temps[$customer][$type]['Chiba'] = $this->getTotalCountByDistriction($where, $type, 'C00%', 'C64%'); $temps[$customer][$type]['Tokyo'] = $this->getTotalCountByDistriction($where, $type, 'C80%', 'C99%'); } //foreach // echo var_dump($temps); } //foreach return $temps; } public function getNews(int $limit): array { $this->getModel()->orderBy($this->getModel()->getPKField(), 'DESC'); $this->getModel()->limit($limit); return $this->getEntitys(); } }