cfmgrv3 init...3
This commit is contained in:
parent
41df1c024f
commit
1c5cf8e9d2
@ -150,53 +150,8 @@ class ZoneController extends APIController
|
|||||||
return parent::delete_process($entity);
|
return parent::delete_process($entity);
|
||||||
}
|
}
|
||||||
//Index관련
|
//Index관련
|
||||||
private function index_setCondition_builder($builder)
|
|
||||||
{
|
|
||||||
foreach ($this->_viewDatas['fieldFilters'] as $field) {
|
|
||||||
$value = $this->request->getVar($field) ? $this->request->getVar($field) : false;
|
|
||||||
if ($value) {
|
|
||||||
$builder->where("cloudflarezone.{$field}", $value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$word = $this->request->getVar('word') ? $this->request->getVar('word') : '';
|
|
||||||
if (isset($word) && $word !== '') {
|
|
||||||
$builder->like('cloudflarezone.domain', $word, 'both'); //befor , after , both
|
|
||||||
$builder->orLike('cloudflarerecord.content', $word, 'both'); //befor , after , both
|
|
||||||
}
|
|
||||||
$start = $this->request->getVar('start') ? $this->request->getVar('start') : '';
|
|
||||||
$end = $this->request->getVar('end') ? $this->request->getVar('end') : '';
|
|
||||||
if (isset($start) && $start !== '' && isset($end) && $end !== '') {
|
|
||||||
$builder->where('cloudflarezone.created_at >=', $start);
|
|
||||||
$builder->where('cloudflarezone.created_at <=', $end);
|
|
||||||
}
|
|
||||||
return $builder;
|
|
||||||
}
|
|
||||||
private function index_getRows_builder(int $page = 0, int $per_page = 0): array
|
|
||||||
{
|
|
||||||
//Totalcount 처리
|
|
||||||
$builder = $this->_model->builder();
|
|
||||||
$builder->select("cloudflarezone.*");
|
|
||||||
$builder->join("cloudflarerecord", "cloudflarezone.uid = cloudflarerecord.zone_uid");
|
|
||||||
$builder = $this->index_setCondition_builder($builder);
|
|
||||||
// log_message("debug", __METHOD__ . "에서 호출\n" . $builder->getCompiledSelect(false));
|
|
||||||
$this->_viewDatas['total_count'] = $builder->countAllResults();
|
|
||||||
//Rows 처리
|
|
||||||
$builder = $this->_model->builder();
|
|
||||||
$builder->select("cloudflarezone.*");
|
|
||||||
$builder->join("cloudflarerecord", "cloudflarezone.uid = cloudflarerecord.zone_uid");
|
|
||||||
$builder = $this->index_setCondition_builder($builder);
|
|
||||||
//OrderBy
|
|
||||||
$order_field = $this->request->getVar('order_field') ? $this->request->getVar('order_field') : 'uid';
|
|
||||||
$order_value = $this->request->getVar('order_value') ? $this->request->getVar('order_value') : 'DESC';
|
|
||||||
$builder->orderBy("cloudflarezone.domain ASC, cloudflarezone.{$order_field} {$order_value}");
|
|
||||||
//Limit
|
|
||||||
$builder->limit($per_page, $page * $per_page - $per_page);
|
|
||||||
log_message("debug", __METHOD__ . "에서 호출\n" . $builder->getCompiledSelect(false));
|
|
||||||
return $builder->get()->getResultArray();
|
|
||||||
}
|
|
||||||
protected function index_getRows(int $page = 0, int $per_page = 0): array
|
protected function index_getRows(int $page = 0, int $per_page = 0): array
|
||||||
{
|
{
|
||||||
// return $this->index_getRows_builder($page, $per_page);
|
|
||||||
return parent::index_getRows($page, $per_page);
|
return parent::index_getRows($page, $per_page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -73,7 +73,12 @@ class ZoneModel extends Model
|
|||||||
//Index 검색용
|
//Index 검색용
|
||||||
public function setIndexWordFilter(string $word)
|
public function setIndexWordFilter(string $word)
|
||||||
{
|
{
|
||||||
$this->like('domain', $word, 'both'); //befor , after , both
|
if (isIPAddress_CommonHelper($this->_viewDatas['fieldDatas']['content'], $this->_viewDatas['fieldDatas']['type'])) {
|
||||||
|
$ids = $this->_model->table('cloudflarerecord')->select('zone_uid')->where('content', $word, 'both')->findAll();
|
||||||
|
$this->wherein('uid', $ids);
|
||||||
|
} else {
|
||||||
|
$this->like('domain', $word, 'both'); //befor , after , both
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public function setIndexDateFilter($start, $end)
|
public function setIndexDateFilter($start, $end)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user