Automation init...3

This commit is contained in:
최준흠 2024-09-13 09:59:30 +09:00
parent cb34143e90
commit 8423908a5f
3 changed files with 20 additions and 8 deletions

View File

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

View File

@ -173,6 +173,11 @@ abstract class CommonModel extends Model
case "content":
$value = htmlentities($formDatas[$field], ENT_QUOTES);
break;
case "updated_at":
case "created_at":
case "deleted_at":
$rules[$field] = "if_exist|valid_date";
break;
default:
$value = $formDatas[$field];
break;

View File

@ -143,7 +143,6 @@ class BoardModel extends CommonModel
//입력후 PID값을 GID값에 넣어주기 위함
return $this->modify($entity, ['gid' => intval($entity->getPK())]);
}
//modify용
public function modify(BoardEntity $entity, array $formDatas): BoardEntity
{