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 형식에 부합되지 않습니다.");
}
$entity = parent::create_process();
// //IP 등록
//IP 등록
foreach ($this->getHelper()->cidrToIpRange($this->formDatas['bandwith']) as $ip) {
$temps = [];
$temps['lineinfo_uid'] = $entity->getPK();
$temps['ip'] = $ip;
$temps['status'] = DEFAULTS['STATUS'];
$this->getIpService()->create($temps, new IpEntity());
$this->getIpService()->createByLineInfo($entity, $ip);
}
return $entity;
}
@ -69,7 +65,7 @@ class LineController extends PartController
protected function view_process($uid): mixed
{
$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);
return parent::view_process($uid);
@ -78,7 +74,7 @@ class LineController extends PartController
protected function index_process(): array
{
$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);
return parent::index_process();

File diff suppressed because one or more lines are too long

View File

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

View File

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

View File

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

View File

@ -123,7 +123,7 @@ abstract class CommonModel extends Model
return $rule;
}
// 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) {
case $this->getPKField():
@ -148,7 +148,13 @@ abstract class CommonModel extends Model
$entity->$field = htmlentities($formDatas[$field], ENT_QUOTES);
break;
default:
$entity->$field = $formDatas[$field];
if ($this->getFieldRule($action, $field) != "if_exist|numeric") {
if (array_key_exists($field, $formDatas) && $formDatas[$field] !== '') {
$entity->$field = $formDatas[$field];
}
} else {
$entity->$field = $formDatas[$field];
}
break;
}
return $entity;
@ -181,7 +187,7 @@ abstract class CommonModel extends Model
LogCollector::debug("입력내용");
LogCollector::debug(var_export($formDatas, true));
foreach (array_keys($formDatas) as $field) {
$entity = $this->convertEntityData($field, $formDatas, $entity);
$entity = $this->convertEntityData(__FUNCTION__, $field, $formDatas, $entity);
}
// primaryKey가 자동입력이 아니면
if (!$this->useAutoIncrement) {
@ -207,7 +213,7 @@ abstract class CommonModel extends Model
LogCollector::debug(var_export($formDatas, true));
LogCollector::debug(var_export($entity->toArray(), true));
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"));

View File

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

View File

@ -17,6 +17,7 @@ class LineModel extends PartModel
"type",
"title",
"bandwith",
"price",
"status",
"start_at",
"updated_at"
@ -32,7 +33,10 @@ class LineModel extends PartModel
}
switch ($field) {
case "clientinfo_uid":
$rule = "if_exist|permit_empty|numeric";
$rule = "if_exist|numeric";
break;
case "price":
$rule = "required|numeric";
break;
case "title":
case "bandwith":
@ -45,18 +49,4 @@ class LineModel extends PartModel
}
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;
}
protected function convertEntityData(string $field, array $formDatas, mixed $entity): mixed
protected function convertEntityData(string $action, string $field, array $formDatas, mixed $entity): mixed
{
switch ($field) {
case "passwd":
@ -65,7 +65,7 @@ class UserModel extends CommonModel
$entity->$field = password_hash($formDatas[$field], PASSWORD_DEFAULT);
break;
default:
$entity = parent::convertEntityData($field, $formDatas, $entity);
$entity = parent::convertEntityData($action, $field, $formDatas, $entity);
break;
}
return $entity;

View File

@ -60,14 +60,14 @@ class UserSNSModel extends CommonModel
}
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) {
case "detail": //content등 textarea를 사용한 Field
$entity->$field = htmlentities($formDatas[$field], ENT_QUOTES);
break;
default:
$entity = parent::convertEntityData($field, $formDatas, $entity);
$entity = parent::convertEntityData($action, $field, $formDatas, $entity);
break;
}
return $entity;

View File

@ -3,6 +3,7 @@
namespace App\Services\Equipment\Part;
use App\Entities\Equipment\Part\IpEntity;
use App\Entities\Equipment\Part\LineEntity;
use App\Models\Equipment\Part\IpModel;
use CodeIgniter\HTTP\IncomingRequest;
@ -39,4 +40,13 @@ class IpService extends PartService
{
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",
"title",
"bandwith",
"price",
"start_at",
"status",
];