Automation init...1

This commit is contained in:
최준흠 2024-09-06 18:15:03 +09:00
parent 514a0a5d44
commit 630e213e3e
5 changed files with 8 additions and 31 deletions

View File

@ -50,7 +50,9 @@ class Crawler extends BaseController
//미디어관련정보 entity에 넣기 //미디어관련정보 entity에 넣기
$entity = new BoardEntity(); $entity = new BoardEntity();
$entity->setTitle($nickname); $entity->setTitle($nickname);
$entity->setContent(is_array($mediaTags) ? implode("\n", $mediaTags) : $mediaTags); $entity->data_type = "html";
$entity->editor_type = "S";
$entity->content = is_array($mediaTags) ? implode("\n", $mediaTags) : $mediaTags;
//망보드에 넣기 //망보드에 넣기
$board->create($entity); $board->create($entity);

View File

@ -20,27 +20,8 @@ class BoardEntity extends CommonEntity
} }
//Common Function //Common Function
public function setTitle(string $value) public function setTitle(string $value): void
{ {
$this->attributes['title'] = $value; $this->attributes['title'] = $value;
} }
public function getGID(): int
{
return $this->attributes['gid'];
}
public function setGID(int $value)
{
$this->attributes['gid'] = $value;
}
public function setText(string $value)
{
$this->attributes['text'] = $value;
}
public function setContent(string $value)
{
$this->attributes['content'] = $value;
}
} }

View File

@ -94,7 +94,7 @@ abstract class CommonModel extends Model
}; };
break; break;
case $this->getTitleField(): case $this->getTitleField():
$rules[$field] = "required|trim|string"; $rules[$field] = "required|string";
break; break;
case "passwd": case "passwd":
$rules[$field] = "required|trim|string"; $rules[$field] = "required|trim|string";

View File

@ -12,7 +12,7 @@ abstract class BoardModel extends CommonModel
protected function __construct(array $fields = []) protected function __construct(array $fields = [])
{ {
$fields = ["title", "is_show", "content", ...$fields]; $fields = ["title", "data_type", "editor_type", "content", ...$fields];
parent::__construct($fields); parent::__construct($fields);
} }
public function getTitleField(): string public function getTitleField(): string
@ -25,15 +25,9 @@ abstract class BoardModel extends CommonModel
case 'gid': case 'gid':
$rules[$field] = "required|numeric"; $rules[$field] = "required|numeric";
break; break;
case 'is_show':
$rules[$field] = "if_exist|numeric";
break;
case "data_type": case "data_type":
$rules[$field] = "if_exist|trim|in_list[html,text]"; $rules[$field] = "if_exist|trim|in_list[html,text]";
break; break;
case "image_path":
$rules[$field] = "if_exist|trim|string";
break;
case "editor_type": case "editor_type":
$rules[$field] = "if_exist|trim|in_list[N,S]"; $rules[$field] = "if_exist|trim|in_list[N,S]";
break; break;
@ -63,7 +57,7 @@ abstract class BoardModel extends CommonModel
{ {
$entity = $this->create_process($entity); $entity = $this->create_process($entity);
//GID값이 PK랑 같은 값 전달 후 Entity 수정 //GID값이 PK랑 같은 값 전달 후 Entity 수정
$entity->setGID($entity->getPK()); $entity->gid = $entity->getPK();
return $this->modify_process($entity); return $this->modify_process($entity);
} }

View File

@ -60,7 +60,7 @@ class UserModel extends CommonModel
{ {
$entity = $this->create_process($entity); $entity = $this->create_process($entity);
//GID값이 PK랑 같은 값 전달 후 Entity 수정 //GID값이 PK랑 같은 값 전달 후 Entity 수정
$entity->setGID($entity->getPK()); $entity->gid = $entity->getPK();
return $this->modify_process($entity); return $this->modify_process($entity);
} }