Automation init...3

This commit is contained in:
최준흠 2024-09-13 11:30:09 +09:00
parent 981eff758a
commit 916f466de4

View File

@ -92,17 +92,16 @@ class YamapLibrary extends MyCrawlerLibrary
} }
private function modifyBoard(BoardEntity $entity) private function modifyBoard(BoardEntity $entity)
{ {
$image_path = array_shift($this->_media_tags["image_path"]); $content = implode("\n", $this->_media_tags["content"]);
if ($image_path === null) { if ($content == "") {
$this->getBoardModel()->delete([$this->getBoardModel()->getFieldPK() => $entity->getPK()]); $this->getBoardModel()->delete([$this->getBoardModel()->getFieldPK() => $entity->getPK()]);
log_message("notice", __FUNCTION__ . " 내용이 없어서 삭제처리"); log_message(level: "warning", message: __FUNCTION__ . "내용이 없어 삭제처리 : {$entity->getPK()}=>{$entity->getTitle()}");
} else {
$formDatas = [
"image_path" => $image_path,
"content" => implode("\n", $this->_media_tags["content"]),
];
$this->getBoardModel()->modify($entity, $formDatas);
} }
$formDatas = [
"image_path" => array_shift($this->_media_tags["image_path"]),
"content" => $content
];
$this->getBoardModel()->modify($entity, $formDatas);
log_message("notice", __FUNCTION__ . " 작업 완료"); log_message("notice", __FUNCTION__ . " 작업 완료");
} }
@ -169,10 +168,11 @@ class YamapLibrary extends MyCrawlerLibrary
__FUNCTION__, __FUNCTION__,
$content $content
)); ));
if ($content !== "") { if ($content === "") {
$this->_media_tags["image_path"][] = sprintf("%s/%s", $this->getMyStorage()->getPath(), $this->getMyStorage()->getOriginName()); throw new \Exception(__FUNCTION__ . " Content의 내용없음");
$this->_media_tags["content"][] = $content;
} }
$this->_media_tags["image_path"][] = sprintf("%s/%s", $this->getMyStorage()->getPath(), $this->getMyStorage()->getOriginName());
$this->_media_tags["content"][] = $content;
return $myStorageLibrary; return $myStorageLibrary;
} }