From cb636881f05601fc60f2d43da7159b700f7b2aac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Fri, 13 Sep 2024 11:39:42 +0900 Subject: [PATCH] Automation init...3 --- app/Libraries/MyCrawler/YamapLibrary.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/Libraries/MyCrawler/YamapLibrary.php b/app/Libraries/MyCrawler/YamapLibrary.php index 1bda72c..c56da2c 100644 --- a/app/Libraries/MyCrawler/YamapLibrary.php +++ b/app/Libraries/MyCrawler/YamapLibrary.php @@ -93,16 +93,17 @@ class YamapLibrary extends MyCrawlerLibrary private function modifyBoard(BoardEntity $entity) { $content = implode("\n", $this->_media_tags["content"]); - if ($content == "") { + if ($content !== "") { + $formDatas = [ + "image_path" => array_shift($this->_media_tags["image_path"]), + "content" => $content + ]; + $this->getBoardModel()->modify($entity, $formDatas); + log_message("notice", __FUNCTION__ . " 작업 완료"); + } else { $this->getBoardModel()->delete([$this->getBoardModel()->getFieldPK() => $entity->getPK()]); log_message(level: "warning", message: __FUNCTION__ . "내용이 없어 삭제처리 : {$entity->getPK()}=>{$entity->getTitle()}"); } - $formDatas = [ - "image_path" => array_shift($this->_media_tags["image_path"]), - "content" => $content - ]; - $this->getBoardModel()->modify($entity, $formDatas); - log_message("notice", __FUNCTION__ . " 작업 완료"); } private function mainPage(string $url): array