diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index f861c17..4d663fa 100644
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -18,7 +18,7 @@ $routes->get('/', 'Home::index');
$routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes) {
$routes->cli('mangboard/level', 'Mangboard::level');
$routes->cli('yamap/crawler', 'Yamap::crawler');
- $routes->cli('yamap/crawler(:any)', 'Yamap::crawler/$1');
+ $routes->cli('yamap/crawler/(:any)', 'Yamap::crawler/$1');
});
$routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'authFilter:manager'], function ($routes) {
diff --git a/app/Controllers/CLI/Yamap.php b/app/Controllers/CLI/Yamap.php
index c14a27b..fe4a7bd 100644
--- a/app/Controllers/CLI/Yamap.php
+++ b/app/Controllers/CLI/Yamap.php
@@ -34,26 +34,29 @@ class Yamap extends BaseController
$yamap->setMyCrawler($crawler);
list($nickname, $mediaInfos, $mediaTags) = $yamap->build();
}
- //2. 사이트 로그인 처리
- if (!in_array("skip_login", $params)) {
- $myWeb = new MyWebLibrary(getenv('daemonidc.host.url'));
- $myWeb->setDebug($isDebug);
- $myWeb->login(
- getenv('daemonidc.login.url'),
- getenv('daemonidc.login.user_id'),
- getenv('daemonidc.login.user_password')
- );
- }
+ // //2. 사이트 로그인 처리
+ // if (!in_array("skip_login", $params)) {
+ // $daemonidc = new MyWebLibrary(getenv('daemonidc.host.url'));
+ // $daemonidc->setDebug($isDebug);
+ // $daemonidc->login(
+ // getenv('daemonidc.login.url'),
+ // getenv('daemonidc.login.user_id'),
+ // getenv('daemonidc.login.user_password')
+ // );
+ // }
//3. 망보드 일반게시판에 게시물 등록 처리
if (!in_array("skip_create", $params)) {
- $mangboard = new FreeboardLibrary();
- $mangboard->setDebug($isDebug);
+ $board = new FreeboardLibrary();
+ $board->setDebug($isDebug);
+ //미디어관련정보 entity에 넣기
$entity = new FreeboardEntity();
- //미디어관련용
$entity->setTitle($nickname);
+ $entity->setText($nickname);
$entity->setContent(is_array($mediaTags) ? implode("\n", $mediaTags) : $mediaTags);
- $mangboard->create($entity);
+
+ //망보드에 넣기
+ $board->create($entity);
}
log_message("notice", "완료되었습니다.");
return true;
diff --git a/app/Entities/Mangboard/FreeboardEntity.php b/app/Entities/Mangboard/FreeboardEntity.php
index 413f184..1665381 100644
--- a/app/Entities/Mangboard/FreeboardEntity.php
+++ b/app/Entities/Mangboard/FreeboardEntity.php
@@ -20,18 +20,27 @@ class FreeboardEntity extends CommonEntity
}
//Common Function
- public function setTitle(string $title)
+ public function setTitle(string $value)
{
- $this->attributes['title'] = $title;
+ $this->attributes['title'] = $value;
}
public function getGID(): int
{
return $this->attributes['gid'];
}
-
- public function setContent(string $content)
+ public function setGID(int $value)
{
- $this->attributes['content'] = $content;
+ $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/Entities/Mangboard/UserEntity.php b/app/Entities/Mangboard/UserEntity.php
index 0996307..280e18e 100644
--- a/app/Entities/Mangboard/UserEntity.php
+++ b/app/Entities/Mangboard/UserEntity.php
@@ -38,8 +38,8 @@ class UserEntity extends CommonEntity
{
return $this->attributes['user_level'];
}
- public function setLevel(int $level): void
+ public function setLevel(int $value): void
{
- $this->attributes['user_level'] = $level;
+ $this->attributes['user_level'] = $value;
}
}
diff --git a/app/Libraries/YamapLibrary.php b/app/Libraries/YamapLibrary.php
index 4a84eaf..1a84138 100644
--- a/app/Libraries/YamapLibrary.php
+++ b/app/Libraries/YamapLibrary.php
@@ -88,7 +88,7 @@ class YamapLibrary extends CommonLibrary
private function download_process(Crawler $crawler, array $options): array
{
- $datas = [];
+ $mediaInfos = [];
log_message("debug", "download:{$options["tag"]},{$options["attr"]}");
$nodes = $this->getMyCrawler()->getNodes($crawler, $options);
foreach ($nodes as $node) {
@@ -98,14 +98,14 @@ class YamapLibrary extends CommonLibrary
if (!$this->getMyStorage()->save($content)) {
continue;
}
- $datas[] = [
+ $mediaInfos[] = [
"orignal" => $node->html(),
"path" => $this->getMyStorage()->getPath(),
"fileName" => $fileName,
"content" => $content
];
}
- return $datas;
+ return $mediaInfos;
}
public function mainPage(): array
@@ -145,27 +145,34 @@ class YamapLibrary extends CommonLibrary
public function detailPage($url): array
{
$crawler = $this->getCrawler($url, getenv("yamap.view.content.tag"));
- $contents = [];
+ $mediaTags = [];
//3. Image 처리
$images = $this->download_process($crawler, ["tag" => "img", "attr" => "src"]);
foreach ($images as $image) {
if ($this->isContainsHttpOrHttps($image['orignal'])) {
- $contents[] = $images['orignal'];
+ $mediaTags[] = $images['orignal'];
} else {
- $contents[] = sprintf("
", $image["path"], $image["fileName"], $image["fileName"]);
+ $mediaTags[] = sprintf("
", $image["path"], $image["fileName"], $image["fileName"]);
};
}
//4. Video(mp4) 처리
$videos = $this->download_process($crawler, ["tag" => "video", "attr" => "src"]);
- foreach ($images as $image) {
- if ($this->isContainsHttpOrHttps($image['orignal'])) {
- $contents[] = $images['orignal'];
+ foreach ($videos as $video) {
+ if ($this->isContainsHttpOrHttps($video['orignal'])) {
+ $mediaTags[] = $videos['orignal'];
} else {
- $contents[] = sprintf("