From 47cdccb74c1626adcf1de5eade8e1a17e8b39e02 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 14:32:57 +0900 Subject: [PATCH] Automation init...1 --- app/Controllers/CLI/Yamap.php | 21 +++++++------ .../{FreeboardEntity.php => BoardEntity.php} | 2 +- app/Libraries/Mangboard/BoardLibrary.php | 27 +++++++++++++++++ app/Libraries/Mangboard/FreeboardLibrary.php | 30 ------------------- .../Mangboard/GalleryBoardLibrary.php | 17 +++++++++++ app/Libraries/Mangboard/MangboardLibrary.php | 14 --------- app/Libraries/Mangboard/UserLibrary.php | 6 ++-- .../{FreeboardModel.php => BoardModel.php} | 19 ++++++------ app/Models/Mangboard/GalleryBoardModel.php | 15 ++++++++++ 9 files changed, 82 insertions(+), 69 deletions(-) rename app/Entities/Mangboard/{FreeboardEntity.php => BoardEntity.php} (95%) create mode 100644 app/Libraries/Mangboard/BoardLibrary.php delete mode 100644 app/Libraries/Mangboard/FreeboardLibrary.php create mode 100644 app/Libraries/Mangboard/GalleryBoardLibrary.php delete mode 100644 app/Libraries/Mangboard/MangboardLibrary.php rename app/Models/Mangboard/{FreeboardModel.php => BoardModel.php} (69%) create mode 100644 app/Models/Mangboard/GalleryBoardModel.php diff --git a/app/Controllers/CLI/Yamap.php b/app/Controllers/CLI/Yamap.php index fe4a7bd..f0f3257 100644 --- a/app/Controllers/CLI/Yamap.php +++ b/app/Controllers/CLI/Yamap.php @@ -2,19 +2,18 @@ namespace App\Controllers\CLI; -use App\Controllers\BaseController; - -use App\Entities\Mangboard\FreeboardEntity; -use App\Libraries\Mangboard\FreeboardLibrary; - -use App\Libraries\MyCrawlerLibrary; -use App\Libraries\MyStorage\MyStorageFileLibrary; -use App\Libraries\MyWebLibrary; use App\Libraries\YamapLibrary; +use App\Libraries\MyWebLibrary; +use App\Libraries\MyStorage\MyStorageFileLibrary; +use App\Libraries\MyCrawlerLibrary; +use App\Libraries\Mangboard\GalleryBoardLibrary; +use App\Entities\Mangboard\BoardEntity; +use App\Controllers\BaseController; + class Yamap extends BaseController { - public function crawler(...$params): bool + public function yamap(...$params): bool { try { $isDebug = in_array("debug", $params); @@ -46,11 +45,11 @@ class Yamap extends BaseController // } //3. 망보드 일반게시판에 게시물 등록 처리 if (!in_array("skip_create", $params)) { - $board = new FreeboardLibrary(); + $board = new GalleryBoardLibrary(); $board->setDebug($isDebug); //미디어관련정보 entity에 넣기 - $entity = new FreeboardEntity(); + $entity = new BoardEntity(); $entity->setTitle($nickname); $entity->setText($nickname); $entity->setContent(is_array($mediaTags) ? implode("\n", $mediaTags) : $mediaTags); diff --git a/app/Entities/Mangboard/FreeboardEntity.php b/app/Entities/Mangboard/BoardEntity.php similarity index 95% rename from app/Entities/Mangboard/FreeboardEntity.php rename to app/Entities/Mangboard/BoardEntity.php index 1665381..184e6f2 100644 --- a/app/Entities/Mangboard/FreeboardEntity.php +++ b/app/Entities/Mangboard/BoardEntity.php @@ -4,7 +4,7 @@ namespace App\Entities\Mangboard; use App\Entities\CommonEntity; -class FreeboardEntity extends CommonEntity +class BoardEntity extends CommonEntity { public function __toString(): string { diff --git a/app/Libraries/Mangboard/BoardLibrary.php b/app/Libraries/Mangboard/BoardLibrary.php new file mode 100644 index 0000000..071c132 --- /dev/null +++ b/app/Libraries/Mangboard/BoardLibrary.php @@ -0,0 +1,27 @@ +_model = $model; + } + protected function getModel(): mixed + { + return $this->_model; + } + + public function create(BoardEntity $entity, array $formDatas = []): BoardEntity + { + $entity = $this->getModel()->create($entity, $formDatas); + log_message("debug", __FUNCTION__ . "=>등록이 완료되었습니다."); + return $entity; + } +} diff --git a/app/Libraries/Mangboard/FreeboardLibrary.php b/app/Libraries/Mangboard/FreeboardLibrary.php deleted file mode 100644 index c454e32..0000000 --- a/app/Libraries/Mangboard/FreeboardLibrary.php +++ /dev/null @@ -1,30 +0,0 @@ -_model === null) { - $this->_model = new FreeboardModel(); - } - return $this->_model; - } - - public function create(FreeboardEntity $entity, array $formDatas = []): FreeboardEntity - { - $entity = $this->getModel()->create($entity, $formDatas); - log_message("debug", __FUNCTION__ . "=>등록이 완료되었습니다."); - return $entity; - } -} diff --git a/app/Libraries/Mangboard/GalleryBoardLibrary.php b/app/Libraries/Mangboard/GalleryBoardLibrary.php new file mode 100644 index 0000000..267af08 --- /dev/null +++ b/app/Libraries/Mangboard/GalleryBoardLibrary.php @@ -0,0 +1,17 @@ +where($this->getPKField(), $uid); return $this->getEntity(); } - public function getEntityByID(string $id): null|FreeboardEntity + public function getEntityByID(string $id): null | BoardEntity { $this->where('user_id', $id); return $this->getEntity(); } //create용 - public function create(FreeboardEntity $entity, array $formDatas = []): FreeboardEntity + public function create(BoardEntity $entity, array $formDatas = []): BoardEntity { $entity = $this->create_process($entity, $formDatas); //GID값이 PK랑 같은 값 전달 후 Entity 수정 @@ -60,7 +59,7 @@ class FreeboardModel extends CommonModel } //modify용 - public function modify(FreeboardEntity $entity, array $formDatas = []): FreeboardEntity + public function modify(BoardEntity $entity, array $formDatas = []): BoardEntity { return $this->modify_process($entity, $formDatas); } diff --git a/app/Models/Mangboard/GalleryBoardModel.php b/app/Models/Mangboard/GalleryBoardModel.php new file mode 100644 index 0000000..a32bf45 --- /dev/null +++ b/app/Models/Mangboard/GalleryBoardModel.php @@ -0,0 +1,15 @@ +