dbms_primeidc_init...1
This commit is contained in:
parent
ade13779f1
commit
3a17120fd1
10
composer.json
Normal file
10
composer.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"require": {
|
||||
"vlucas/phpdotenv": "^5.6"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"lib\\": "lib/"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,16 +1,17 @@
|
||||
<?php
|
||||
|
||||
use lib\Controllers\SiteController;
|
||||
use Dotenv\Dotenv;
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
require_once "lib/Core/Constants.php";
|
||||
|
||||
try {
|
||||
$control = "lib\\Controllers\\{$argv[1]}";
|
||||
// $control = $argv[1];
|
||||
$function = $argv[2];
|
||||
$dotenv = Dotenv::createImmutable(__DIR__);
|
||||
$dotenv->load();
|
||||
$control = new SiteController();
|
||||
return $control->dashboard();
|
||||
$control = new $control();
|
||||
return $control->$function(isset($arvg[3]) ? $argv[3] : "dbms.prime-idc.jp");
|
||||
} catch (\Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ class SiteController extends CommonController
|
||||
// 최근7일 신규서버수
|
||||
//예외,service_line = "test","substitution"
|
||||
$excepts = ["test", "substitution"];
|
||||
$this->day = intval(getenv("SITE_DASHBOARD_DAY") ?? 7);
|
||||
$this->day = intval($_ENV['SITE_DASHBOARD_DAY'] ?? $_SERVER['SITE_DASHBOARD_DAY'] ?? 7);
|
||||
$this->newServers = $this->getService()->getNewServerCount($this->day, $excepts);
|
||||
// 금일기준 미납서버수
|
||||
//예외,service_line = "test","substitution",C012:게임윙,C116:WinIDC,C219:IDC-JP
|
||||
|
||||
@ -25,8 +25,6 @@ abstract class Model
|
||||
final public function getConnect(): PDO
|
||||
{
|
||||
if ($this->_db === null) {
|
||||
// $dsn = sprintf("%s:host=%s;dbname=%s;charset=%s", getenv('DATABASE_DRIVER'), getenv('DATABASE_HOST'), getenv('DATABASE_DB'), getenv('DATABASE_CHARSET'));
|
||||
// $this->_db = new PDO($dsn, getenv('DATABASE_ID'), getenv('DATABASE_PASSWORD'));
|
||||
$driver = $_ENV['DATABASE_DRIVER'] ?? $_SERVER['DATABASE_DRIVER'] ?? 'mysql';
|
||||
$host = $_ENV['DATABASE_HOST'] ?? $_SERVER['DATABASE_HOST'] ?? 'localhost';
|
||||
$dbname = $_ENV['DATABASE_DB'] ?? $_SERVER['DATABASE_DB'] ?? 'test';
|
||||
@ -71,25 +69,25 @@ abstract class Model
|
||||
}
|
||||
return implode(",", $temps);
|
||||
}
|
||||
final public function getData(mixed $columns, mixed $values = null, $delimeter = ","): string
|
||||
final public function makeQuery(mixed $columns, mixed $values = null, $delimeter = ","): string
|
||||
{
|
||||
$temps = [];
|
||||
if (is_array($columns)) {
|
||||
foreach ($columns as $column => $value) {
|
||||
$value = $this->getValue($value);
|
||||
$temps[] = $column . $value === null ? "" : $value;
|
||||
$temps[] = sprintf("%s%s", $column, $value === null ? "" : "=" . $value);
|
||||
}
|
||||
} else {
|
||||
$value = $this->getValue($values);
|
||||
$temps[] = $columns . $value === null ? "" : $value;
|
||||
$temps[] = sprintf("%s%s", $columns, $value === null ? "" : "=" . $value);
|
||||
}
|
||||
// throw new \Exception("DATA:" . $columns . $value === null ? "NULL" : $value);
|
||||
// var_export($temps);
|
||||
return implode($delimeter, $temps);
|
||||
return implode($delimeter . " ", $temps);
|
||||
}
|
||||
final public function where(mixed $columns, mixed $values = null, string $delimeter = "AND"): void
|
||||
{
|
||||
$this->_wheres[] = $this->getData($columns, $values, $delimeter);
|
||||
$query = $this->makeQuery($columns, $values, $delimeter);
|
||||
$this->_wheres[] = count($this->_wheres) ? $delimeter . " " . $query : $query;
|
||||
}
|
||||
final public function orWhere(mixed $columns, mixed $values = null, string $delimeter = "OR"): void
|
||||
{
|
||||
@ -126,12 +124,12 @@ abstract class Model
|
||||
//CURD문
|
||||
final protected function create_process(mixed $columns, mixed $values = null): bool|PDOStatement
|
||||
{
|
||||
$query = sprintf("INSERT INTO %s VALUES(%s) %s", $this->getTable(), $this->getData($columns, $values), $this->getWhere());
|
||||
$query = sprintf("INSERT INTO %s VALUES(%s) %s", $this->getTable(), $this->makeQuery($columns, $values), $this->getWhere());
|
||||
return $this->execute($query);
|
||||
} //
|
||||
final protected function modify_process(mixed $columns, mixed $values = null): bool|PDOStatement
|
||||
{
|
||||
$query = sprintf("UPDATE %s SET %s %s", $this->getTable(), $this->getData($columns, $values), $this->getWhere());
|
||||
$query = sprintf("UPDATE %s SET %s %s", $this->getTable(), $this->makeQuery($columns, $values), $this->getWhere());
|
||||
return $this->execute($query);
|
||||
} //
|
||||
final protected function delete_process(): bool|PDOStatement
|
||||
@ -149,7 +147,7 @@ abstract class Model
|
||||
}
|
||||
final public function orderBy(mixed $columns, mixed $direction = null): void
|
||||
{
|
||||
$this->_querys["ORDERBY"] = " ORDERBY " . $this->getData($columns, $direction, " ");
|
||||
$this->_querys["ORDERBY"] = " ORDERBY " . $this->makeQuery($columns, $direction, " ");
|
||||
}
|
||||
final public function limit(int $start, mixed $end = "", bool $offset = false): void
|
||||
{
|
||||
|
||||
@ -53,8 +53,8 @@ class ServiceService extends CommonService
|
||||
$this->getModel()->where("service_status", 'o');
|
||||
$this->getModel()->whereNotIn("service_line", $excepts);
|
||||
$count = $this->getModel()->countAllResults();
|
||||
throw new \Exception("TEST");
|
||||
// echo "<BR>" . $this->getModel()->getLastQuery();
|
||||
// throw new \Exception($this->getModel()->getLastQuery());
|
||||
echo __FUNCTION__ . ":" . $this->getModel()->getLastQuery();
|
||||
return $count;
|
||||
}
|
||||
public function getUnPaymentCount(array $excepts): int|string
|
||||
@ -64,6 +64,7 @@ class ServiceService extends CommonService
|
||||
$this->getModel()->whereNotIn("service_line", $excepts);
|
||||
$count = $this->getModel()->countAllResults();
|
||||
// throw new \Exception($this->getModel()->getLastQuery());
|
||||
echo __FUNCTION__ . ":" . $this->getModel()->getLastQuery();
|
||||
return $count;
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
<style>
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
@ -40,27 +39,27 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($this->results as $company => $service) {?>
|
||||
<?php foreach ($this->totalcount as $company => $service) { ?>
|
||||
<tr>
|
||||
<td><?php echo $company ?></td>
|
||||
<?php foreach ($service as $name => $location) {?>
|
||||
<?php foreach ($service as $name => $location) { ?>
|
||||
<td><?php echo $location['Tokyo']; ?></td>
|
||||
<td><?php echo $location['Chiba']; ?></td>
|
||||
<?php }?>
|
||||
<?php } ?>
|
||||
<td><?php echo $service['test']['Tokyo'] + $service['test']['Chiba']; ?></td>
|
||||
<td><?php echo $this->summary[$company]['Tokyo'] - $service['test']['Tokyo']; ?></td>
|
||||
<td><?php echo $this->summary[$company]['Chiba'] - $service['test']['Chiba']; ?></td>
|
||||
<td><?php echo $this->summary[$company]['Tokyo'] - $service['test']['Tokyo'] + $this->summary[$company]['Chiba'] - $service['test']['Chiba']; ?></td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td>총합계</td>
|
||||
<?php foreach ($this->_values['types'] as $type) {?>
|
||||
<?php foreach ($this->siteInfo['totalcount_types'] as $type) { ?>
|
||||
<td><?php echo $this->summary[$type]['Tokyo']; ?></td>
|
||||
<td><?php echo $this->summary[$type]['Chiba']; ?></td>
|
||||
<?php }?>
|
||||
<?php } ?>
|
||||
<td><?php echo $this->summary['test']['Tokyo'] + $this->summary['test']['Chiba']; ?></td>
|
||||
<td><?php echo $this->total['Tokyo'] - $this->summary['test']['Tokyo']; ?></td>
|
||||
<td><?php echo $this->total['Chiba'] - $this->summary['test']['Chiba']; ?></td>
|
||||
Loading…
Reference in New Issue
Block a user