Automation init...1
This commit is contained in:
parent
552b180cda
commit
47cdccb74c
@ -2,19 +2,18 @@
|
|||||||
|
|
||||||
namespace App\Controllers\CLI;
|
namespace App\Controllers\CLI;
|
||||||
|
|
||||||
use App\Controllers\BaseController;
|
|
||||||
|
|
||||||
use App\Entities\Mangboard\FreeboardEntity;
|
|
||||||
use App\Libraries\Mangboard\FreeboardLibrary;
|
|
||||||
|
|
||||||
use App\Libraries\MyCrawlerLibrary;
|
|
||||||
use App\Libraries\MyStorage\MyStorageFileLibrary;
|
|
||||||
use App\Libraries\MyWebLibrary;
|
|
||||||
use App\Libraries\YamapLibrary;
|
use App\Libraries\YamapLibrary;
|
||||||
|
|
||||||
|
use App\Libraries\MyWebLibrary;
|
||||||
|
use App\Libraries\MyStorage\MyStorageFileLibrary;
|
||||||
|
use App\Libraries\MyCrawlerLibrary;
|
||||||
|
use App\Libraries\Mangboard\GalleryBoardLibrary;
|
||||||
|
use App\Entities\Mangboard\BoardEntity;
|
||||||
|
use App\Controllers\BaseController;
|
||||||
|
|
||||||
class Yamap extends BaseController
|
class Yamap extends BaseController
|
||||||
{
|
{
|
||||||
public function crawler(...$params): bool
|
public function yamap(...$params): bool
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$isDebug = in_array("debug", $params);
|
$isDebug = in_array("debug", $params);
|
||||||
@ -46,11 +45,11 @@ class Yamap extends BaseController
|
|||||||
// }
|
// }
|
||||||
//3. 망보드 일반게시판에 게시물 등록 처리
|
//3. 망보드 일반게시판에 게시물 등록 처리
|
||||||
if (!in_array("skip_create", $params)) {
|
if (!in_array("skip_create", $params)) {
|
||||||
$board = new FreeboardLibrary();
|
$board = new GalleryBoardLibrary();
|
||||||
$board->setDebug($isDebug);
|
$board->setDebug($isDebug);
|
||||||
|
|
||||||
//미디어관련정보 entity에 넣기
|
//미디어관련정보 entity에 넣기
|
||||||
$entity = new FreeboardEntity();
|
$entity = new BoardEntity();
|
||||||
$entity->setTitle($nickname);
|
$entity->setTitle($nickname);
|
||||||
$entity->setText($nickname);
|
$entity->setText($nickname);
|
||||||
$entity->setContent(is_array($mediaTags) ? implode("\n", $mediaTags) : $mediaTags);
|
$entity->setContent(is_array($mediaTags) ? implode("\n", $mediaTags) : $mediaTags);
|
||||||
|
|||||||
@ -4,7 +4,7 @@ namespace App\Entities\Mangboard;
|
|||||||
|
|
||||||
use App\Entities\CommonEntity;
|
use App\Entities\CommonEntity;
|
||||||
|
|
||||||
class FreeboardEntity extends CommonEntity
|
class BoardEntity extends CommonEntity
|
||||||
{
|
{
|
||||||
public function __toString(): string
|
public function __toString(): string
|
||||||
{
|
{
|
||||||
27
app/Libraries/Mangboard/BoardLibrary.php
Normal file
27
app/Libraries/Mangboard/BoardLibrary.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Libraries\Mangboard;
|
||||||
|
|
||||||
|
use App\Libraries\CommonLibrary;
|
||||||
|
use App\Entities\Mangboard\BoardEntity;
|
||||||
|
|
||||||
|
abstract class BoardLibrary extends CommonLibrary
|
||||||
|
{
|
||||||
|
private $_model = null;
|
||||||
|
protected function __construct($model)
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->_model = $model;
|
||||||
|
}
|
||||||
|
protected function getModel(): mixed
|
||||||
|
{
|
||||||
|
return $this->_model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create(BoardEntity $entity, array $formDatas = []): BoardEntity
|
||||||
|
{
|
||||||
|
$entity = $this->getModel()->create($entity, $formDatas);
|
||||||
|
log_message("debug", __FUNCTION__ . "=>등록이 완료되었습니다.");
|
||||||
|
return $entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,30 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Libraries\Mangboard;
|
|
||||||
|
|
||||||
use App\Entities\Mangboard\FreeboardEntity;
|
|
||||||
use App\Models\Mangboard\FreeboardModel;
|
|
||||||
|
|
||||||
class FreeboardLibrary extends MangboardLibrary
|
|
||||||
{
|
|
||||||
|
|
||||||
private $_model = null;
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
private function getModel(): FreeboardModel
|
|
||||||
{
|
|
||||||
if ($this->_model === null) {
|
|
||||||
$this->_model = new FreeboardModel();
|
|
||||||
}
|
|
||||||
return $this->_model;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function create(FreeboardEntity $entity, array $formDatas = []): FreeboardEntity
|
|
||||||
{
|
|
||||||
$entity = $this->getModel()->create($entity, $formDatas);
|
|
||||||
log_message("debug", __FUNCTION__ . "=>등록이 완료되었습니다.");
|
|
||||||
return $entity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
17
app/Libraries/Mangboard/GalleryBoardLibrary.php
Normal file
17
app/Libraries/Mangboard/GalleryBoardLibrary.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,14 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Libraries\Mangboard;
|
|
||||||
|
|
||||||
use App\Libraries\CommonLibrary;
|
|
||||||
|
|
||||||
abstract class MangboardLibrary extends CommonLibrary
|
|
||||||
{
|
|
||||||
|
|
||||||
protected function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
namespace App\Libraries\Mangboard;
|
namespace App\Libraries\Mangboard;
|
||||||
|
|
||||||
use App\Entities\Mangboard\UserEntity;
|
|
||||||
use App\Models\Mangboard\UserModel;
|
use App\Models\Mangboard\UserModel;
|
||||||
|
use App\Libraries\CommonLibrary;
|
||||||
|
use App\Entities\Mangboard\UserEntity;
|
||||||
|
|
||||||
class UserLibrary extends MangboardLibrary
|
class UserLibrary extends CommonLibrary
|
||||||
{
|
{
|
||||||
|
|
||||||
private $_model = null;
|
private $_model = null;
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,18 +2,17 @@
|
|||||||
|
|
||||||
namespace App\Models\Mangboard;
|
namespace App\Models\Mangboard;
|
||||||
|
|
||||||
use App\Entities\Mangboard\FreeboardEntity;
|
|
||||||
use App\Models\CommonModel;
|
use App\Models\CommonModel;
|
||||||
|
use App\Entities\Mangboard\BoardEntity;
|
||||||
|
|
||||||
class FreeboardModel extends CommonModel
|
abstract class BoardModel extends CommonModel
|
||||||
{
|
{
|
||||||
protected $table = 'mb_board_free';
|
|
||||||
protected $primaryKey = 'pid';
|
protected $primaryKey = 'pid';
|
||||||
protected $returnType = FreeboardEntity::class;
|
protected $returnType = BoardEntity::class;
|
||||||
|
|
||||||
public function __construct()
|
protected function __construct(array $fields = [])
|
||||||
{
|
{
|
||||||
$fields = ["title", "text", "content"];
|
$fields = ["title", "text", "content", ...$fields];
|
||||||
parent::__construct($fields);
|
parent::__construct($fields);
|
||||||
}
|
}
|
||||||
public function getTitleField(): string
|
public function getTitleField(): string
|
||||||
@ -37,19 +36,19 @@ class FreeboardModel extends CommonModel
|
|||||||
return $rules;
|
return $rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEntityByPK(int $uid): null|FreeboardEntity
|
public function getEntityByPK(int $uid): null | BoardEntity
|
||||||
{
|
{
|
||||||
$this->where($this->getPKField(), $uid);
|
$this->where($this->getPKField(), $uid);
|
||||||
return $this->getEntity();
|
return $this->getEntity();
|
||||||
}
|
}
|
||||||
public function getEntityByID(string $id): null|FreeboardEntity
|
public function getEntityByID(string $id): null | BoardEntity
|
||||||
{
|
{
|
||||||
$this->where('user_id', $id);
|
$this->where('user_id', $id);
|
||||||
return $this->getEntity();
|
return $this->getEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
//create용
|
//create용
|
||||||
public function create(FreeboardEntity $entity, array $formDatas = []): FreeboardEntity
|
public function create(BoardEntity $entity, array $formDatas = []): BoardEntity
|
||||||
{
|
{
|
||||||
$entity = $this->create_process($entity, $formDatas);
|
$entity = $this->create_process($entity, $formDatas);
|
||||||
//GID값이 PK랑 같은 값 전달 후 Entity 수정
|
//GID값이 PK랑 같은 값 전달 후 Entity 수정
|
||||||
@ -60,7 +59,7 @@ class FreeboardModel extends CommonModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
//modify용
|
//modify용
|
||||||
public function modify(FreeboardEntity $entity, array $formDatas = []): FreeboardEntity
|
public function modify(BoardEntity $entity, array $formDatas = []): BoardEntity
|
||||||
{
|
{
|
||||||
return $this->modify_process($entity, $formDatas);
|
return $this->modify_process($entity, $formDatas);
|
||||||
}
|
}
|
||||||
15
app/Models/Mangboard/GalleryBoardModel.php
Normal file
15
app/Models/Mangboard/GalleryBoardModel.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Mangboard;
|
||||||
|
|
||||||
|
use App\Models\CommonModel;
|
||||||
|
|
||||||
|
class GalleryBoardModel extends BoardModel
|
||||||
|
{
|
||||||
|
protected $table = 'mb_gallery_general';
|
||||||
|
|
||||||
|
public function __construct(array $fields = [])
|
||||||
|
{
|
||||||
|
parent::__construct($fields);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user