Automation init...1

This commit is contained in:
최준흠 2024-09-06 22:09:51 +09:00
parent a83c1629cc
commit 80a4f4ade4
5 changed files with 13 additions and 43 deletions

View File

@ -2,12 +2,13 @@
namespace App\Controllers\CLI; namespace App\Controllers\CLI;
use App\Libraries\YamapLibrary; use App\Models\Mangboard\BoardModel;
use App\Libraries\YamapLibrary;
use App\Libraries\MyWebLibrary; use App\Libraries\MyWebLibrary;
use App\Libraries\MyStorage\FileLibrary; use App\Libraries\MyStorage\FileLibrary;
use App\Libraries\MyCrawlerLibrary; use App\Libraries\MyCrawlerLibrary;
use App\Libraries\Mangboard\GalleryBoardLibrary; use App\Libraries\Mangboard\BoardLibrary;
use App\Entities\Mangboard\BoardEntity; use App\Entities\Mangboard\BoardEntity;
use App\Controllers\BaseController; use App\Controllers\BaseController;
@ -17,8 +18,7 @@ class Crawler extends BaseController
{ {
try { try {
$isDebug = in_array("debug", $params); $isDebug = in_array("debug", $params);
$nickname = getenv("yamap.view.default.nickname"); //1.Yamap사이트에서 자유게시판에서 최근 게시물 데이터 가져오기
//Yamap사이트에서 자유게시판에서 최근 게시물 데이터 가져오기
if (!in_array("skip_build", $params)) { if (!in_array("skip_build", $params)) {
$myWeb = new MyWebLibrary(getenv('yamap.host.url')); $myWeb = new MyWebLibrary(getenv('yamap.host.url'));
$storage = new FileLibrary(WRITEPATH . "uploads"); $storage = new FileLibrary(WRITEPATH . "uploads");
@ -41,10 +41,10 @@ class Crawler extends BaseController
// getenv('daemonidc.login.user_id'), // getenv('daemonidc.login.user_id'),
// getenv('daemonidc.login.user_password') // getenv('daemonidc.login.user_password')
// ); // );
// } // }
//3. 망보드 일반게시판에 게시물 등록 처리 //3. 망보드 일반게시판에 게시물 등록 처리
if (!in_array("skip_create", $params)) { if (!in_array("skip_create", $params)) {
$board = new GalleryBoardLibrary(); $board = new BoardLibrary(new BoardModel(getenv("crawler.yamap.registration.table")));
$board->setDebug($isDebug); $board->setDebug($isDebug);
//미디어관련정보 entity에 넣기 //미디어관련정보 entity에 넣기

View File

@ -5,10 +5,10 @@ namespace App\Libraries\Mangboard;
use App\Libraries\CommonLibrary; use App\Libraries\CommonLibrary;
use App\Entities\Mangboard\BoardEntity; use App\Entities\Mangboard\BoardEntity;
abstract class BoardLibrary extends CommonLibrary class BoardLibrary extends CommonLibrary
{ {
private $_model = null; private $_model = null;
protected function __construct($model) public function __construct($model)
{ {
parent::__construct(); parent::__construct();
$this->_model = $model; $this->_model = $model;

View File

@ -1,17 +0,0 @@
<?php
namespace App\Libraries\Mangboard;
use App\Models\Mangboard\GalleryBoardModel;
class GalleryBoardLibrary extends BoardLibrary
{
public function __construct()
{
parent::__construct(new GalleryBoardModel());
}
protected function getModel(): GalleryBoardModel
{
return parent::getModel();
}
}

View File

@ -5,14 +5,16 @@ namespace App\Models\Mangboard;
use App\Models\CommonModel; use App\Models\CommonModel;
use App\Entities\Mangboard\BoardEntity; use App\Entities\Mangboard\BoardEntity;
abstract class BoardModel extends CommonModel class BoardModel extends CommonModel
{ {
// protected $table = 'mb_board_free';
protected $primaryKey = 'pid'; protected $primaryKey = 'pid';
protected $returnType = BoardEntity::class; protected $returnType = BoardEntity::class;
protected function __construct(array $fields = []) public function __construct(string $table)
{ {
$fields = ["title", "user_name", "data_type", "editor_type", "content", ...$fields]; $this->table = $table;
$fields = ["title", "user_name", "data_type", "editor_type", "content"];
parent::__construct($fields); parent::__construct($fields);
} }
public function getTitleField(): string public function getTitleField(): string

View File

@ -1,15 +0,0 @@
<?php
namespace App\Models\Mangboard;
use App\Models\CommonModel;
class GalleryBoardModel extends BoardModel
{
protected $table = 'mb_gallery_general';
public function __construct()
{
parent::__construct([]);
}
}