cfmgrv4 init...10
This commit is contained in:
parent
083568a3b6
commit
866d3f4555
@ -95,4 +95,9 @@ class AccountModel extends CommonModel
|
|||||||
{
|
{
|
||||||
return $this->modify_process($entity, $formDatas);
|
return $this->modify_process($entity, $formDatas);
|
||||||
}
|
}
|
||||||
|
//List 검색용
|
||||||
|
public function setList_WordFilter(string $word): void
|
||||||
|
{
|
||||||
|
$this->orLike(self::TABLE . self::TITLE, $word, 'both');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -86,9 +86,9 @@ class AuditLogModel extends CommonModel
|
|||||||
return $this->modify_process($entity, $formDatas);
|
return $this->modify_process($entity, $formDatas);
|
||||||
}
|
}
|
||||||
//List 검색용
|
//List 검색용
|
||||||
public function setList_WordFilter(string $word, $field = null): void
|
public function setList_WordFilter(string $word): void
|
||||||
{
|
{
|
||||||
parent::setList_WordFilter($word, $field);
|
$this->orLike(self::TABLE . self::TITLE, $word, 'both');
|
||||||
$this->orLike(self::TABLE . '.zone_name', $word, 'both');
|
$this->orLike(self::TABLE . '.zone_name', $word, 'both');
|
||||||
$this->orLike(self::TABLE . '.meta', $word, 'both');
|
$this->orLike(self::TABLE . '.meta', $word, 'both');
|
||||||
$this->orLike(self::TABLE . '.resource', $word, 'both');
|
$this->orLike(self::TABLE . '.resource', $word, 'both');
|
||||||
|
|||||||
@ -86,4 +86,10 @@ class AuthModel extends CommonModel
|
|||||||
{
|
{
|
||||||
return $this->modify_process($entity, $formDatas);
|
return $this->modify_process($entity, $formDatas);
|
||||||
}
|
}
|
||||||
|
public function setList_WordFilter(string $word): void
|
||||||
|
{
|
||||||
|
$this->orLike(self::TABLE . self::TITLE, $word, 'both');
|
||||||
|
$this->orLike(self::TABLE . '.authkey', $word, 'both');
|
||||||
|
$this->orLike(self::TABLE . '.oldkey', $word, 'both');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -105,9 +105,9 @@ class FirewallModel extends CommonModel
|
|||||||
return $this->modify_process($entity, $formDatas);
|
return $this->modify_process($entity, $formDatas);
|
||||||
}
|
}
|
||||||
//List 검색용
|
//List 검색용
|
||||||
public function setList_WordFilter(string $word, $field = null): void
|
public function setList_WordFilter(string $word): void
|
||||||
{
|
{
|
||||||
parent::setList_WordFilter($word, $field);
|
$this->orLike(self::TABLE . self::TITLE, $word, 'both');
|
||||||
$this->orLike(self::TABLE . '.' . self::TITLE, $word, 'both');
|
$this->orLike(self::TABLE . '.expression', $word, 'both');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -128,9 +128,13 @@ class RecordModel extends CommonModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//List 검색용
|
//List 검색용
|
||||||
public function setList_WordFilter(string $word, $field = null): void
|
public function setList_WordFilter(string $word): void
|
||||||
{
|
{
|
||||||
parent::setList_WordFilter($word, $field);
|
if ($this->isIPAddress($word, 'ipv4')) {
|
||||||
|
$this->where(self::TABLE . '.content', $word);
|
||||||
|
} else {
|
||||||
|
$this->orLike(self::TABLE . self::TITLE, $word, 'both');
|
||||||
$this->orLike(self::TABLE . '.content', $word, 'both');
|
$this->orLike(self::TABLE . '.content', $word, 'both');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -130,8 +130,9 @@ class ZoneModel extends CommonModel
|
|||||||
return is_null($this->first()) ? true : false;
|
return is_null($this->first()) ? true : false;
|
||||||
}
|
}
|
||||||
//List 검색용
|
//List 검색용
|
||||||
public function setList_WordFilter(string $word, $field = null): void
|
public function setList_WordFilter(string $word): void
|
||||||
{
|
{
|
||||||
|
if ($this->isIPAddress($word, 'ipv4')) {
|
||||||
//Record의 content(IP검색)을 하기위함
|
//Record의 content(IP검색)을 하기위함
|
||||||
//Join 방식사용
|
//Join 방식사용
|
||||||
// $this->join(RecordModel::TABLE, sprintf(
|
// $this->join(RecordModel::TABLE, sprintf(
|
||||||
@ -145,15 +146,14 @@ class ZoneModel extends CommonModel
|
|||||||
// $this->orLike(RecordModel::TABLE . '.content', $word, 'both');
|
// $this->orLike(RecordModel::TABLE . '.content', $word, 'both');
|
||||||
//Subquery 방식사용
|
//Subquery 방식사용
|
||||||
$recordModel = new RecordModel();
|
$recordModel = new RecordModel();
|
||||||
$recordModel->like(RecordModel::TABLE . '.content', $word, 'both');
|
$recordModel->setList_WordFilter($word);
|
||||||
$recordModel->orlike(RecordModel::TABLE . '.' . RecordModel::TITLE, $word, 'both');
|
|
||||||
$recorde_entitys = $recordModel->select(RecordModel::PARENT)->findAll();
|
$recorde_entitys = $recordModel->select(RecordModel::PARENT)->findAll();
|
||||||
$zone_uids = array_column($recorde_entitys, RecordModel::PARENT);
|
$zone_uids = array_column($recorde_entitys, RecordModel::PARENT);
|
||||||
parent::setList_WordFilter($word, $field);
|
|
||||||
if (count($zone_uids)) {
|
|
||||||
$this->orWhereIn(self::TABLE . '.' . self::PK, array_values($zone_uids));
|
$this->orWhereIn(self::TABLE . '.' . self::PK, array_values($zone_uids));
|
||||||
}
|
} else {
|
||||||
// var_dump($zone_uids);
|
$this->orLike(self::TABLE . self::TITLE, $word, 'both');
|
||||||
// exit;
|
$this->orLike(self::TABLE . '.name_servers', $word, 'both');
|
||||||
|
$this->orLike(self::TABLE . '.original_name_servers', $word, 'both');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,7 +54,7 @@ abstract class CommonModel extends Model
|
|||||||
abstract public function getFields(): array;
|
abstract public function getFields(): array;
|
||||||
abstract public function getFilterFields(): array;
|
abstract public function getFilterFields(): array;
|
||||||
abstract public function getBatchJobFields(): array;
|
abstract public function getBatchJobFields(): array;
|
||||||
|
abstract public function setList_WordFilter(string $word): void;
|
||||||
final public function getTable(): string
|
final public function getTable(): string
|
||||||
{
|
{
|
||||||
return $this->table;
|
return $this->table;
|
||||||
@ -219,16 +219,29 @@ abstract class CommonModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List용
|
// List용
|
||||||
|
final public function isIPAddress(string $ip, $type = false): bool
|
||||||
|
{
|
||||||
|
switch ($type) {
|
||||||
|
case 'ipv4':
|
||||||
|
$result = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
|
||||||
|
break;
|
||||||
|
case 'ipv6':
|
||||||
|
$result = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
|
||||||
|
break;
|
||||||
|
case 'all':
|
||||||
|
$result = filter_var($ip, FILTER_VALIDATE_IP);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$result = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
final public function setList_FieldFilter(string $field, int|string $value): void
|
final public function setList_FieldFilter(string $field, int|string $value): void
|
||||||
{
|
{
|
||||||
$this->where($this->getTable() . '.' . $field, $value);
|
$this->where($this->getTable() . '.' . $field, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setList_WordFilter(string $word, string $field): void
|
|
||||||
{
|
|
||||||
$this->like($this->getTable() . '.' . $field, $word, 'both'); // before, after, both
|
|
||||||
}
|
|
||||||
|
|
||||||
final public function setList_DateFilter(string $start, string $end, $field = "created_at"): void
|
final public function setList_DateFilter(string $start, string $end, $field = "created_at"): void
|
||||||
{
|
{
|
||||||
if ($start !== DEFAULTS['EMPTY']) {
|
if ($start !== DEFAULTS['EMPTY']) {
|
||||||
|
|||||||
@ -73,4 +73,10 @@ class MapurlModel extends CommonModel
|
|||||||
{
|
{
|
||||||
return $this->modify_process($entity, $formDatas);
|
return $this->modify_process($entity, $formDatas);
|
||||||
}
|
}
|
||||||
|
//List 검색용
|
||||||
|
public function setList_WordFilter(string $word): void
|
||||||
|
{
|
||||||
|
$this->orLike(self::TABLE . self::TITLE, $word, 'both');
|
||||||
|
$this->orLike(self::TABLE . '.new_url', $word, 'both');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,4 +66,10 @@ class MyLogModel extends CommonModel
|
|||||||
{
|
{
|
||||||
return $this->create_process(new MyLogEntity(), $formDatas);
|
return $this->create_process(new MyLogEntity(), $formDatas);
|
||||||
}
|
}
|
||||||
|
//List 검색용
|
||||||
|
public function setList_WordFilter(string $word): void
|
||||||
|
{
|
||||||
|
$this->orLike(self::TABLE . self::TITLE, $word, 'both');
|
||||||
|
$this->orLike(self::TABLE . '.content', $word, 'both');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -116,4 +116,11 @@ class UserModel extends CommonModel
|
|||||||
{
|
{
|
||||||
return $this->modify_process($entity, $formDatas);
|
return $this->modify_process($entity, $formDatas);
|
||||||
}
|
}
|
||||||
|
//List 검색용
|
||||||
|
public function setList_WordFilter(string $word): void
|
||||||
|
{
|
||||||
|
$this->orLike(self::TABLE . '.id', $word, 'both');
|
||||||
|
$this->orLike(self::TABLE . self::TITLE, $word, 'both');
|
||||||
|
$this->orLike(self::TABLE . '.email', $word, 'both');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,10 +95,16 @@ class UserSNSModel extends CommonModel
|
|||||||
{
|
{
|
||||||
return $this->create_process(new UserSNSEntity(), $formDatas);
|
return $this->create_process(new UserSNSEntity(), $formDatas);
|
||||||
}
|
}
|
||||||
|
|
||||||
//modify용
|
//modify용
|
||||||
public function modify(UserSNSEntity $entity, array $formDatas): UserSNSEntity
|
public function modify(UserSNSEntity $entity, array $formDatas): UserSNSEntity
|
||||||
{
|
{
|
||||||
return $this->modify_process($entity, $formDatas);
|
return $this->modify_process($entity, $formDatas);
|
||||||
}
|
}
|
||||||
|
//List 검색용
|
||||||
|
public function setList_WordFilter(string $word): void
|
||||||
|
{
|
||||||
|
$this->orLike(self::TABLE . '.id', $word, 'both');
|
||||||
|
$this->orLike(self::TABLE . self::TITLE, $word, 'both');
|
||||||
|
$this->orLike(self::TABLE . '.email', $word, 'both');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user