cfmgrv4 init...2
This commit is contained in:
parent
21055497b0
commit
3e2a27d4d6
@ -5,6 +5,7 @@ namespace App\Controllers\Admin\Cloudflare;
|
||||
use App\Helpers\Cloudflare\RecordHelper;
|
||||
use App\Libraries\Cloudflare\Record;
|
||||
use App\Models\Cloudflare\RecordModel;
|
||||
use App\Models\Cloudflare\ZoneModel;
|
||||
use CodeIgniter\HTTP\DownloadResponse;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
@ -176,6 +177,35 @@ class RecordController extends CloudflareController
|
||||
$this->entity = $this->getMyLibrary()->delete($this->entity);
|
||||
}
|
||||
// 리스트
|
||||
protected function list_entitys_process(): array
|
||||
{
|
||||
$this->list_condition_process();
|
||||
//기본Soring처리
|
||||
$this->getModel()->orderBy(ZoneModel::TABLE . "." . ZoneModel::TITLE . " ASC ," . $this->getModel()::TITLE . " ASC");
|
||||
//Sorting 처리
|
||||
$this->order_field = $this->request->getVar('order_field') ?: DEFAULTS['EMPTY'];
|
||||
$this->order_value = $this->request->getVar('order_value') ?: DEFAULTS['EMPTY'];
|
||||
if ($this->order_field !== DEFAULTS['EMPTY'] && $this->order_value !== DEFAULTS['EMPTY']) {
|
||||
$this->getModel()->orderBy(sprintf(
|
||||
"%s.%s %s",
|
||||
$this->getModel()::TABLE,
|
||||
$this->order_field,
|
||||
$this->order_value
|
||||
));
|
||||
}
|
||||
$this->getModel()->limit($this->per_page, $this->page * $this->per_page - $this->per_page);
|
||||
//Join을 해서 도메인부터 Sorting하기위함
|
||||
$this->getModel()->join(ZoneModel::TABLE, sprintf(
|
||||
"%s.%s=%s.%s",
|
||||
$this->getModel()::TABLE,
|
||||
$this->getModel()::PARENT,
|
||||
ZoneModel::TABLE,
|
||||
ZoneModel::PK
|
||||
));
|
||||
$entitys = $this->getModel()->select($this->getModel()::TABLE . '.*')->findAll();
|
||||
log_message("debug", $this->getModel()->getLastQuery());
|
||||
return $entitys;
|
||||
}
|
||||
public function index(): string
|
||||
{
|
||||
$this->action = __FUNCTION__;
|
||||
|
||||
@ -5,6 +5,7 @@ namespace App\Controllers\Admin\Cloudflare;
|
||||
use App\Helpers\Cloudflare\ZoneHelper;
|
||||
use App\Libraries\Cloudflare\Record;
|
||||
use App\Libraries\Cloudflare\Zone;
|
||||
use App\Models\Cloudflare\AccountModel;
|
||||
use App\Models\Cloudflare\ZoneModel;
|
||||
use CodeIgniter\HTTP\DownloadResponse;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
@ -210,6 +211,35 @@ class ZoneController extends CloudflareController
|
||||
$this->entity = $this->getMyLibrary()->delete($this->entity);
|
||||
}
|
||||
// 리스트
|
||||
protected function list_entitys_process(): array
|
||||
{
|
||||
$this->list_condition_process();
|
||||
//기본Soring처리
|
||||
$this->getModel()->orderBy(orderBy: AccountModel::TABLE . "." . AccountModel::TITLE . " ASC ," . $this->getModel()::TITLE . " ASC");
|
||||
//Sorting 처리
|
||||
$this->order_field = $this->request->getVar('order_field') ?: DEFAULTS['EMPTY'];
|
||||
$this->order_value = $this->request->getVar('order_value') ?: DEFAULTS['EMPTY'];
|
||||
if ($this->order_field !== DEFAULTS['EMPTY'] && $this->order_value !== DEFAULTS['EMPTY']) {
|
||||
$this->getModel()->orderBy(sprintf(
|
||||
"%s.%s %s",
|
||||
$this->getModel()::TABLE,
|
||||
$this->order_field,
|
||||
$this->order_value
|
||||
));
|
||||
}
|
||||
$this->getModel()->limit($this->per_page, $this->page * $this->per_page - $this->per_page);
|
||||
//Join을 해서 도메인부터 Sorting하기위함
|
||||
$this->getModel()->join(AccountModel::TABLE, sprintf(
|
||||
"%s.%s=%s.%s",
|
||||
$this->getModel()::TABLE,
|
||||
$this->getModel()::PARENT,
|
||||
AccountModel::TABLE,
|
||||
AccountModel::PK
|
||||
));
|
||||
$entitys = $this->getModel()->select($this->getModel()::TABLE . '.*')->findAll();
|
||||
log_message("debug", $this->getModel()->getLastQuery());
|
||||
return $entitys;
|
||||
}
|
||||
public function index(): string
|
||||
{
|
||||
$this->action = __FUNCTION__;
|
||||
|
||||
@ -270,7 +270,7 @@ abstract class MVController extends CommonController
|
||||
}
|
||||
}
|
||||
// 리스트
|
||||
private function list_condition_process(): void
|
||||
protected function list_condition_process(): void
|
||||
{
|
||||
//조건절 처리
|
||||
foreach ($this->filter_fields as $field) {
|
||||
@ -326,17 +326,17 @@ abstract class MVController extends CommonController
|
||||
$this->total_page = $pager->getPageCount($pager_group);
|
||||
return $pager->links($pager_group, $template);
|
||||
}
|
||||
private function list_entitys_process(): array
|
||||
protected function list_entitys_process(): array
|
||||
{
|
||||
$this->list_condition_process();
|
||||
//Sorting 처리
|
||||
$this->order_field = $this->request->getVar('order_field') ?: DEFAULTS['EMPTY'];
|
||||
$this->order_value = $this->request->getVar('order_value') ?: DEFAULTS['EMPTY'];
|
||||
if ($this->order_field !== DEFAULTS['EMPTY'] && $this->order_value !== DEFAULTS['EMPTY']) {
|
||||
$this->getModel()->setList_OrderBy("{$this->order_field} {$this->order_value}");
|
||||
$this->getModel()->orderBy("{$this->order_field} {$this->order_value}");
|
||||
}
|
||||
$this->getModel()->limit($this->per_page, $this->page * $this->per_page - $this->per_page);
|
||||
$entitys = $this->getModel()->select($this->getModel()->getTable() . '.*')->findAll();
|
||||
$entitys = $this->getModel()->select($this->getModel()::TABLE . '.*')->findAll();
|
||||
log_message("debug", $this->getModel()->getLastQuery());
|
||||
return $entitys;
|
||||
}
|
||||
|
||||
@ -116,19 +116,6 @@ class RecordModel extends CommonModel
|
||||
public function setList_WordFilter(string $word, $field = null): void
|
||||
{
|
||||
parent::setList_WordFilter($word, $field);
|
||||
$this->orLike('content', $word, 'both');
|
||||
}
|
||||
public function setList_OrderBy(string $order = ""): void
|
||||
{
|
||||
//Join을 해서 도메인부터 Sorting하기위함
|
||||
$this->join(ZoneModel::TABLE, sprintf(
|
||||
"%s.%s=%s.%s",
|
||||
self::TABLE,
|
||||
self::PARENT,
|
||||
ZoneModel::TABLE,
|
||||
ZoneModel::PK
|
||||
));
|
||||
$this->orderBy(ZoneModel::TABLE . "." . ZoneModel::TITLE . " ASC ," . self::TITLE . " ASC");
|
||||
parent::setList_OrderBy($order);
|
||||
$this->orLike(self::TABLE . '.content', $word, 'both');
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,17 +122,4 @@ class ZoneModel extends CommonModel
|
||||
// $zone_uids = array_column($zone_uids, RecordModel::PARENT);
|
||||
// $this->orWhereIn(self::TABLE . '.' . self::PK, array_values($zone_uids));
|
||||
}
|
||||
public function setList_OrderBy(string $order = ""): void
|
||||
{
|
||||
//Join을 해서 도메인부터 Sorting하기위함
|
||||
$this->join(AccountModel::TABLE, sprintf(
|
||||
"%s.%s=%s.%s",
|
||||
self::TABLE,
|
||||
self::PARENT,
|
||||
AccountModel::TABLE,
|
||||
AccountModel::PK
|
||||
));
|
||||
$this->orderBy(AccountModel::TABLE . "." . AccountModel::TITLE . " ASC ," . self::TITLE . " ASC");
|
||||
parent::setList_OrderBy($order);
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,8 +75,7 @@ abstract class CommonModel extends Model
|
||||
$rule .= $action == "create" ? "|is_unique[{$this->table}.{$field}]" : "";
|
||||
} else {
|
||||
$rule = "required|numeric";
|
||||
}
|
||||
;
|
||||
};
|
||||
break;
|
||||
case $this->getTitleField():
|
||||
$rule = "required|string";
|
||||
@ -216,21 +215,15 @@ abstract class CommonModel extends Model
|
||||
}
|
||||
public function setList_WordFilter(string $word, string $field = null): void
|
||||
{
|
||||
$this->like($field ?? $this->getTitleField(), $word, 'both'); //befor , after , both
|
||||
$this->like($this->getTable() . '.' . ($field ?? $this->getTitleField()), $word, 'both'); //befor , after , both
|
||||
}
|
||||
final public function setList_DateFilter(string $start, string $end, $field = "created_at"): void
|
||||
{
|
||||
if ($start !== DEFAULTS['EMPTY']) {
|
||||
$this->where("{$field} >= '{$start} 00:00:00'");
|
||||
$this->where($this->getTable() . ".{$field} >= '{$start} 00:00:00'");
|
||||
}
|
||||
if ($end !== DEFAULTS['EMPTY']) {
|
||||
$this->where("{$field} <= '{$end} 23:59:59'");
|
||||
}
|
||||
}
|
||||
public function setList_OrderBy(string $order = ""): void
|
||||
{
|
||||
if ($order) {
|
||||
$this->orderBy($order);
|
||||
$this->where($this->getTable() . ".{$field} <= '{$end} 23:59:59'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user