From 630e213e3e330bbbd0271571c63c9aef9c9a8cbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Fri, 6 Sep 2024 18:15:03 +0900 Subject: [PATCH] Automation init...1 --- app/Controllers/CLI/Crawler.php | 4 +++- app/Entities/Mangboard/BoardEntity.php | 21 +-------------------- app/Models/CommonModel.php | 2 +- app/Models/Mangboard/BoardModel.php | 10 ++-------- app/Models/Mangboard/UserModel.php | 2 +- 5 files changed, 8 insertions(+), 31 deletions(-) diff --git a/app/Controllers/CLI/Crawler.php b/app/Controllers/CLI/Crawler.php index f7a5e5a..5f114c0 100644 --- a/app/Controllers/CLI/Crawler.php +++ b/app/Controllers/CLI/Crawler.php @@ -50,7 +50,9 @@ class Crawler extends BaseController //미디어관련정보 entity에 넣기 $entity = new BoardEntity(); $entity->setTitle($nickname); - $entity->setContent(is_array($mediaTags) ? implode("\n", $mediaTags) : $mediaTags); + $entity->data_type = "html"; + $entity->editor_type = "S"; + $entity->content = is_array($mediaTags) ? implode("\n", $mediaTags) : $mediaTags; //망보드에 넣기 $board->create($entity); diff --git a/app/Entities/Mangboard/BoardEntity.php b/app/Entities/Mangboard/BoardEntity.php index 184e6f2..07ee398 100644 --- a/app/Entities/Mangboard/BoardEntity.php +++ b/app/Entities/Mangboard/BoardEntity.php @@ -20,27 +20,8 @@ class BoardEntity extends CommonEntity } //Common Function - public function setTitle(string $value) + public function setTitle(string $value): void { $this->attributes['title'] = $value; } - - public function getGID(): int - { - return $this->attributes['gid']; - } - public function setGID(int $value) - { - $this->attributes['gid'] = $value; - } - - - public function setText(string $value) - { - $this->attributes['text'] = $value; - } - public function setContent(string $value) - { - $this->attributes['content'] = $value; - } } diff --git a/app/Models/CommonModel.php b/app/Models/CommonModel.php index 2dd6771..23f8fd5 100644 --- a/app/Models/CommonModel.php +++ b/app/Models/CommonModel.php @@ -94,7 +94,7 @@ abstract class CommonModel extends Model }; break; case $this->getTitleField(): - $rules[$field] = "required|trim|string"; + $rules[$field] = "required|string"; break; case "passwd": $rules[$field] = "required|trim|string"; diff --git a/app/Models/Mangboard/BoardModel.php b/app/Models/Mangboard/BoardModel.php index be04be7..d79e123 100644 --- a/app/Models/Mangboard/BoardModel.php +++ b/app/Models/Mangboard/BoardModel.php @@ -12,7 +12,7 @@ abstract class BoardModel extends CommonModel protected function __construct(array $fields = []) { - $fields = ["title", "is_show", "content", ...$fields]; + $fields = ["title", "data_type", "editor_type", "content", ...$fields]; parent::__construct($fields); } public function getTitleField(): string @@ -25,15 +25,9 @@ abstract class BoardModel extends CommonModel case 'gid': $rules[$field] = "required|numeric"; break; - case 'is_show': - $rules[$field] = "if_exist|numeric"; - break; case "data_type": $rules[$field] = "if_exist|trim|in_list[html,text]"; break; - case "image_path": - $rules[$field] = "if_exist|trim|string"; - break; case "editor_type": $rules[$field] = "if_exist|trim|in_list[N,S]"; break; @@ -63,7 +57,7 @@ abstract class BoardModel extends CommonModel { $entity = $this->create_process($entity); //GID값이 PK랑 같은 값 전달 후 Entity 수정 - $entity->setGID($entity->getPK()); + $entity->gid = $entity->getPK(); return $this->modify_process($entity); } diff --git a/app/Models/Mangboard/UserModel.php b/app/Models/Mangboard/UserModel.php index 807cc2c..63586ca 100644 --- a/app/Models/Mangboard/UserModel.php +++ b/app/Models/Mangboard/UserModel.php @@ -60,7 +60,7 @@ class UserModel extends CommonModel { $entity = $this->create_process($entity); //GID값이 PK랑 같은 값 전달 후 Entity 수정 - $entity->setGID($entity->getPK()); + $entity->gid = $entity->getPK(); return $this->modify_process($entity); }