cfmgrv3 init...2

This commit is contained in:
최준흠 2023-06-19 18:51:21 +09:00
parent 980bdfd9cb
commit 1e527f9d8b
7 changed files with 13 additions and 22 deletions

View File

@ -81,11 +81,4 @@ class FirewallController extends APIController
$entity = $api->sync($entity);
return parent::sync_process($entity);
}
//Index관련
protected function index_process()
{
$this->_model->orderBy('zone_uid', 'ASC');
$this->_model->orderBy('description', 'ASC');
return parent::index_process();
}
}

View File

@ -137,13 +137,6 @@ class RecordController extends APIController
$entity = $api->sync($entity);
return parent::sync_process($entity);
}
//Index관련
protected function index_process()
{
$this->_model->orderBy('zone_uid', 'ASC');
$this->_model->orderBy('host', 'ASC');
return parent::index_process();
}
//CDN고정관련
final public function cdnToggle(string $uid)
{

View File

@ -151,13 +151,6 @@ class ZoneController extends APIController
$entity = $api->sync($entity);
return parent::sync_process($entity);
}
//Index관련
protected function index_process()
{
$this->_model->orderBy('account_uid', 'ASC');
$this->_model->orderBy('domain', 'ASC');
return parent::index_process();
}
//Reload관련
final public function reload($uid)
{

View File

@ -443,7 +443,7 @@ class CommonController extends BaseController
//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';
$this->_model->orderBy($order_field, $order_value);
$this->_model->setIndexOrderBy($order_field, $order_value);
$rows = $per_page ? $this->_model->findAll($per_page, $page * $per_page - $per_page) : $this->_model->findAll();
Log::add("debug", __METHOD__ . "에서 호출[{$per_page}:{$page}=>{$page}*{$per_page}-{$per_page}]\n" . $this->_model->getLastQuery());
return $rows;

View File

@ -78,4 +78,8 @@ class FirewallModel extends Model
$this->where('created_at >=', $start);
$this->where('created_at <=', $end);
}
public function setIndexOrderBy($field, $order = 'ASC')
{
$this->orderBy(['zone_uid' => 'ASC', 'description' => 'ASC', $field => $order]);
}
}

View File

@ -81,6 +81,10 @@ class RecordModel extends Model
$this->where('created_at >=', $start);
$this->where('created_at <=', $end);
}
public function setIndexOrderBy($field, $order = 'ASC')
{
$this->orderBy(['zone_uid' => 'ASC', 'host' => 'ASC', $field => $order]);
}
//도메인이 이미 존재하는지 체크
public function isUniqueHost($zone_uid, string $host, string $content): bool

View File

@ -80,6 +80,10 @@ class ZoneModel extends Model
$this->where('created_at >=', $start);
$this->where('created_at <=', $end);
}
public function setIndexOrderBy($field, $order = 'ASC')
{
$this->orderBy(['account_uid' => 'ASC', 'domain' => 'ASC', $field => $order]);
}
//도메인이 이미 존재하는지 체크
public function isUniqueDomain(string $account_uid, string $domain): bool