dbms_init...1

This commit is contained in:
최준흠 2025-05-29 16:47:46 +09:00
parent 34e6a3b9ae
commit f0b8033973
12 changed files with 189 additions and 174 deletions

View File

@ -55,13 +55,9 @@ class LineController extends PartController
throw new \Exception("{$this->formDatas['bandwith']}는 CIDR 형식에 부합되지 않습니다."); throw new \Exception("{$this->formDatas['bandwith']}는 CIDR 형식에 부합되지 않습니다.");
} }
$entity = parent::create_process(); $entity = parent::create_process();
// //IP 등록 //IP 등록
foreach ($this->getHelper()->cidrToIpRange($this->formDatas['bandwith']) as $ip) { foreach ($this->getHelper()->cidrToIpRange($this->formDatas['bandwith']) as $ip) {
$temps = []; $this->getIpService()->createByLineInfo($entity, $ip);
$temps['lineinfo_uid'] = $entity->getPK();
$temps['ip'] = $ip;
$temps['status'] = DEFAULTS['STATUS'];
$this->getIpService()->create($temps, new IpEntity());
} }
return $entity; return $entity;
} }
@ -69,7 +65,7 @@ class LineController extends PartController
protected function view_process($uid): mixed protected function view_process($uid): mixed
{ {
$fields = [ $fields = [
'fields' => ['clientinfo_uid', 'type', 'title', 'bandwith', 'status', "start_at", 'created_at'], 'fields' => ['clientinfo_uid', 'type', 'title', 'bandwith', 'price', 'status', "start_at", 'created_at'],
]; ];
$this->init('view', $fields); $this->init('view', $fields);
return parent::view_process($uid); return parent::view_process($uid);
@ -78,7 +74,7 @@ class LineController extends PartController
protected function index_process(): array protected function index_process(): array
{ {
$fields = [ $fields = [
'fields' => ['clientinfo_uid', 'type', 'title', 'bandwith', 'status', "start_at", 'created_at'], 'fields' => ['clientinfo_uid', 'type', 'title', 'bandwith', 'price', 'status', "start_at", 'created_at'],
]; ];
$this->init('index', $fields); $this->init('index', $fields);
return parent::index_process(); return parent::index_process();

File diff suppressed because one or more lines are too long

View File

@ -4,9 +4,9 @@
"settings": { "settings": {
"width": 3500, "width": 3500,
"height": 3500, "height": 3500,
"scrollTop": -838.878, "scrollTop": -2183.8422,
"scrollLeft": -562.8418, "scrollLeft": -2138.2058,
"zoomLevel": 0.79, "zoomLevel": 0.82,
"show": 511, "show": 511,
"database": 4, "database": 4,
"databaseName": "", "databaseName": "",
@ -2088,17 +2088,17 @@
"name": "type", "name": "type",
"comment": "", "comment": "",
"dataType": "VARCHAR(20)", "dataType": "VARCHAR(20)",
"default": "'Rackmount'", "default": "'default'",
"options": 8, "options": 8,
"ui": { "ui": {
"keys": 0, "keys": 0,
"widthName": 60, "widthName": 60,
"widthComment": 60, "widthComment": 60,
"widthDataType": 75, "widthDataType": 75,
"widthDefault": 67 "widthDefault": 60
}, },
"meta": { "meta": {
"updateAt": 1747878140724, "updateAt": 1748503859099,
"createAt": 1745819764138 "createAt": 1745819764138
} }
}, },
@ -7845,20 +7845,20 @@
"hmZlcR-Pw2C_ife1zzo5o": { "hmZlcR-Pw2C_ife1zzo5o": {
"id": "hmZlcR-Pw2C_ife1zzo5o", "id": "hmZlcR-Pw2C_ife1zzo5o",
"tableId": "B4qGh3KZsXHQ3_4EOgwJZ", "tableId": "B4qGh3KZsXHQ3_4EOgwJZ",
"name": "created_at", "name": "manufactur_at",
"comment": "", "comment": "제조일",
"dataType": "TIMESTAMP", "dataType": "TIMESTAMP",
"default": "CURRENT_TIMESTAMP", "default": "CURRENT_TIMESTAMP",
"options": 8, "options": 8,
"ui": { "ui": {
"keys": 0, "keys": 0,
"widthName": 60, "widthName": 78,
"widthComment": 60, "widthComment": 60,
"widthDataType": 65, "widthDataType": 65,
"widthDefault": 122 "widthDefault": 122
}, },
"meta": { "meta": {
"updateAt": 1748326090783, "updateAt": 1748503847252,
"createAt": 1748326062212 "createAt": 1748326062212
} }
}, },
@ -9546,7 +9546,7 @@
"columnIds": [ "columnIds": [
"F9EPb6nsDx6Tf3GG8rvP1" "F9EPb6nsDx6Tf3GG8rvP1"
], ],
"x": 1588.9997, "x": 1604.9997,
"y": 2200.890085714286, "y": 2200.890085714286,
"direction": 2 "direction": 2
}, },
@ -9574,7 +9574,7 @@
"columnIds": [ "columnIds": [
"F9EPb6nsDx6Tf3GG8rvP1" "F9EPb6nsDx6Tf3GG8rvP1"
], ],
"x": 1588.9997, "x": 1604.9997,
"y": 2250.0329428571436, "y": 2250.0329428571436,
"direction": 2 "direction": 2
}, },
@ -9630,7 +9630,7 @@
"columnIds": [ "columnIds": [
"F9EPb6nsDx6Tf3GG8rvP1" "F9EPb6nsDx6Tf3GG8rvP1"
], ],
"x": 1588.9997, "x": 1604.9997,
"y": 2299.175800000001, "y": 2299.175800000001,
"direction": 2 "direction": 2
}, },
@ -9686,7 +9686,7 @@
"columnIds": [ "columnIds": [
"F9EPb6nsDx6Tf3GG8rvP1" "F9EPb6nsDx6Tf3GG8rvP1"
], ],
"x": 1588.9997, "x": 1604.9997,
"y": 2348.3186571428582, "y": 2348.3186571428582,
"direction": 2 "direction": 2
}, },
@ -9742,7 +9742,7 @@
"columnIds": [ "columnIds": [
"F9EPb6nsDx6Tf3GG8rvP1" "F9EPb6nsDx6Tf3GG8rvP1"
], ],
"x": 1588.9997, "x": 1604.9997,
"y": 2446.604371428573, "y": 2446.604371428573,
"direction": 2 "direction": 2
}, },
@ -9798,7 +9798,7 @@
"columnIds": [ "columnIds": [
"F9EPb6nsDx6Tf3GG8rvP1" "F9EPb6nsDx6Tf3GG8rvP1"
], ],
"x": 1588.9997, "x": 1604.9997,
"y": 2397.4615142857156, "y": 2397.4615142857156,
"direction": 2 "direction": 2
}, },
@ -9910,7 +9910,7 @@
"columnIds": [ "columnIds": [
"F9EPb6nsDx6Tf3GG8rvP1" "F9EPb6nsDx6Tf3GG8rvP1"
], ],
"x": 1588.9997, "x": 1604.9997,
"y": 2151.747228571429, "y": 2151.747228571429,
"direction": 2 "direction": 2
}, },

View File

@ -10,6 +10,6 @@ class SoftwareEntity extends LinkEntity
const TITLE = SoftwareModel::TITLE; const TITLE = SoftwareModel::TITLE;
public function getAdapterInfoUID(): string public function getAdapterInfoUID(): string
{ {
return $this->attributes['softwareininfo_uid']; return $this->attributes['softwareinfo_uid'];
} }
} }

View File

@ -13,11 +13,11 @@ return [
'created_at' => "작성일", 'created_at' => "작성일",
], ],
'DEFAULTS' => [ 'DEFAULTS' => [
'type' => 'general', 'type' => 'default',
'status' => 'default' 'status' => 'default'
], ],
"TYPE" => [ "TYPE" => [
"general" => "일반", "default" => "일반",
"dedicated" => "전용", "dedicated" => "전용",
"defence" => "방어", "defence" => "방어",
], ],

View File

@ -123,7 +123,7 @@ abstract class CommonModel extends Model
return $rule; return $rule;
} }
// create, modify 직전 작업용 작업 // create, modify 직전 작업용 작업
protected function convertEntityData(string $field, array $formDatas, mixed $entity): mixed protected function convertEntityData(string $action, string $field, array $formDatas, mixed $entity): mixed
{ {
switch ($field) { switch ($field) {
case $this->getPKField(): case $this->getPKField():
@ -148,7 +148,13 @@ abstract class CommonModel extends Model
$entity->$field = htmlentities($formDatas[$field], ENT_QUOTES); $entity->$field = htmlentities($formDatas[$field], ENT_QUOTES);
break; break;
default: default:
if ($this->getFieldRule($action, $field) != "if_exist|numeric") {
if (array_key_exists($field, $formDatas) && $formDatas[$field] !== '') {
$entity->$field = $formDatas[$field]; $entity->$field = $formDatas[$field];
}
} else {
$entity->$field = $formDatas[$field];
}
break; break;
} }
return $entity; return $entity;
@ -181,7 +187,7 @@ abstract class CommonModel extends Model
LogCollector::debug("입력내용"); LogCollector::debug("입력내용");
LogCollector::debug(var_export($formDatas, true)); LogCollector::debug(var_export($formDatas, true));
foreach (array_keys($formDatas) as $field) { foreach (array_keys($formDatas) as $field) {
$entity = $this->convertEntityData($field, $formDatas, $entity); $entity = $this->convertEntityData(__FUNCTION__, $field, $formDatas, $entity);
} }
// primaryKey가 자동입력이 아니면 // primaryKey가 자동입력이 아니면
if (!$this->useAutoIncrement) { if (!$this->useAutoIncrement) {
@ -207,7 +213,7 @@ abstract class CommonModel extends Model
LogCollector::debug(var_export($formDatas, true)); LogCollector::debug(var_export($formDatas, true));
LogCollector::debug(var_export($entity->toArray(), true)); LogCollector::debug(var_export($entity->toArray(), true));
foreach (array_keys($formDatas) as $field) { foreach (array_keys($formDatas) as $field) {
$entity = $this->convertEntityData($field, $formDatas, $entity); $entity = $this->convertEntityData(__FUNCTION__, $field, $formDatas, $entity);
} }
//수정일추가 //수정일추가
$entity->setUpdatedAt(date("Y-m-d H:i:s")); $entity->setUpdatedAt(date("Y-m-d H:i:s"));

View File

@ -30,9 +30,11 @@ class IpModel extends PartModel
} }
switch ($field) { switch ($field) {
case "lineinfo_uid": case "lineinfo_uid":
case "price":
$rule = "required|numeric"; $rule = "required|numeric";
break; break;
case "price":
$rule = "if_exist|numeric";
break;
case "ip": case "ip":
$rule = "required|trim|valid_ip[both]"; //ipv4 , ipv6 , both(ipv4,ipv6) $rule = "required|trim|valid_ip[both]"; //ipv4 , ipv6 , both(ipv4,ipv6)
break; break;

View File

@ -17,6 +17,7 @@ class LineModel extends PartModel
"type", "type",
"title", "title",
"bandwith", "bandwith",
"price",
"status", "status",
"start_at", "start_at",
"updated_at" "updated_at"
@ -32,7 +33,10 @@ class LineModel extends PartModel
} }
switch ($field) { switch ($field) {
case "clientinfo_uid": case "clientinfo_uid":
$rule = "if_exist|permit_empty|numeric"; $rule = "if_exist|numeric";
break;
case "price":
$rule = "required|numeric";
break; break;
case "title": case "title":
case "bandwith": case "bandwith":
@ -45,18 +49,4 @@ class LineModel extends PartModel
} }
return $rule; return $rule;
} }
protected function convertEntityData(string $field, array $formDatas, mixed $entity): mixed
{
switch ($field) {
case 'clientinfo_uid':
if (array_key_exists($field, $formDatas) && $formDatas[$field] !== '') {
$entity->$field = $formDatas[$field];
}
break;
default:
$entity = parent::convertEntityData($field, $formDatas, $entity);
break;
}
return $entity;
}
} }

View File

@ -55,7 +55,7 @@ class UserModel extends CommonModel
} }
return $rule; return $rule;
} }
protected function convertEntityData(string $field, array $formDatas, mixed $entity): mixed protected function convertEntityData(string $action, string $field, array $formDatas, mixed $entity): mixed
{ {
switch ($field) { switch ($field) {
case "passwd": case "passwd":
@ -65,7 +65,7 @@ class UserModel extends CommonModel
$entity->$field = password_hash($formDatas[$field], PASSWORD_DEFAULT); $entity->$field = password_hash($formDatas[$field], PASSWORD_DEFAULT);
break; break;
default: default:
$entity = parent::convertEntityData($field, $formDatas, $entity); $entity = parent::convertEntityData($action, $field, $formDatas, $entity);
break; break;
} }
return $entity; return $entity;

View File

@ -60,14 +60,14 @@ class UserSNSModel extends CommonModel
} }
return $rule; return $rule;
} }
protected function convertEntityData(string $field, array $formDatas, mixed $entity): mixed protected function convertEntityData(string $action, string $field, array $formDatas, mixed $entity): mixed
{ {
switch ($field) { switch ($field) {
case "detail": //content등 textarea를 사용한 Field case "detail": //content등 textarea를 사용한 Field
$entity->$field = htmlentities($formDatas[$field], ENT_QUOTES); $entity->$field = htmlentities($formDatas[$field], ENT_QUOTES);
break; break;
default: default:
$entity = parent::convertEntityData($field, $formDatas, $entity); $entity = parent::convertEntityData($action, $field, $formDatas, $entity);
break; break;
} }
return $entity; return $entity;

View File

@ -3,6 +3,7 @@
namespace App\Services\Equipment\Part; namespace App\Services\Equipment\Part;
use App\Entities\Equipment\Part\IpEntity; use App\Entities\Equipment\Part\IpEntity;
use App\Entities\Equipment\Part\LineEntity;
use App\Models\Equipment\Part\IpModel; use App\Models\Equipment\Part\IpModel;
use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\IncomingRequest;
@ -39,4 +40,13 @@ class IpService extends PartService
{ {
return ['status']; return ['status'];
} }
public function createByLineInfo(LineEntity $entity, string $ip): IpEntity
{
$formDatas = [];
$formDatas['lineinfo_uid'] = $entity->getPK();
$formDatas['ip'] = $ip;
$formDatas['status'] = DEFAULTS['STATUS'];
return $this->create($formDatas, new IpEntity());
}
} }

View File

@ -29,6 +29,7 @@ class LineService extends PartService
"type", "type",
"title", "title",
"bandwith", "bandwith",
"price",
"start_at", "start_at",
"status", "status",
]; ];