cfmgrv4 init...4

This commit is contained in:
최준흠 2024-10-25 10:55:02 +09:00
parent 9f817cb856
commit 1a34a5c707
6 changed files with 20 additions and 20 deletions

View File

@ -17,7 +17,7 @@ use CodeIgniter\HotReloader\HotReloader;
*
* You create code that can execute by subscribing to events with
* the 'on()' method. This accepts any form of callable, including
* Closures, that will be executed when the event is triggered.
* Closures, that will be executed when the event is webhooked.
*
* Example:
* Events::on('create', [$myInstance, 'myMethod']);

View File

@ -29,13 +29,13 @@ $routes->group('/user', function ($routes) {
});
$routes->group('/cloudflare', ['namespace' => 'App\Controllers\Cloudflare'], function ($routes) {
$routes->group('zone', function ($routes) {
$routes->post('trigger', 'ZoneController::trigger');
$routes->post('webhook', 'ZoneController::webhook');
});
$routes->group('record', function ($routes) {
$routes->post('trigger', 'RecordController::trigger');
$routes->post('webhook', 'RecordController::webhook');
});
$routes->group('firewall', function ($routes) {
$routes->post('trigger', 'FirewallController::trigger');
$routes->post('webhook', 'FirewallController::webhook');
});
});
$routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'authFilter:manager'], function ($routes) {

View File

@ -50,18 +50,18 @@ abstract class CloudflareController extends MVController
return $this->_recordModel;
}
//Trigger
protected function trigger_process(): void
protected function webhook_process(): void
{
log_message("debug", var_export($this->request->getVar(), true));
}
final protected function trigger_procedure(): ResponseInterface
final protected function webhook_procedure(): ResponseInterface
{
//Transaction Start
$this->getService()->getModel()->transStart();
try {
// 여기에 필요한 로직을 구현하세요
log_message("debug", var_export($this->request->getVar(), true));
$this->trigger_process();
$this->webhook_process();
$this->message = "{$this->class_name}: Trigger 작업이 완료되었습니다.";
$this->getService()->getModel()->transCommit();
log_message("notice", __FUNCTION__ . $this->message);

View File

@ -30,9 +30,9 @@ class FirewallController extends CloudflareController
return $this->service;
}
//Trigger작업
protected function trigger_process(): void
protected function webhook_process(): void
{
parent::trigger_process();
parent::webhook_process();
// //자신정보정의
// $this->entity = $this->getModel()->getEntityByPK($uid);
// if ($this->entity === null) {
@ -44,8 +44,8 @@ class FirewallController extends CloudflareController
// $this->entity = $this->getMyLibrary()->sync($this->entity);
log_message("notice", message: "Firewall Trigger 작업완료");
}
public function trigger(): ResponseInterface
public function webhook(): ResponseInterface
{
return $this->trigger_procedure();
return $this->webhook_procedure();
}
}

View File

@ -30,9 +30,9 @@ class RecordController extends CloudflareController
return $this->service;
}
//Trigger작업
protected function trigger_process(): void
protected function webhook_process(): void
{
parent::trigger_process();
parent::webhook_process();
// //자신정보정의
// $this->entity = $this->getModel()->getEntityByPK($uid);
// if ($this->entity === null) {
@ -44,8 +44,8 @@ class RecordController extends CloudflareController
// $this->entity = $this->getMyLibrary()->sync($this->entity);
log_message("notice", "Record Trigger 작업완료");
}
public function trigger(): ResponseInterface
public function webhook(): ResponseInterface
{
return $this->trigger_procedure();
return $this->webhook_procedure();
}
}

View File

@ -30,9 +30,9 @@ class ZoneController extends CloudflareController
return $this->service;
}
//Trigger작업
protected function trigger_process(): void
protected function webhook_process(): void
{
parent::trigger_process();
parent::webhook_process();
// //자신정보정의
// $this->entity = $this->getModel()->getEntityByPK($uid);
// if ($this->entity === null) {
@ -44,8 +44,8 @@ class ZoneController extends CloudflareController
// $this->entity = $this->getMyLibrary()->sync($this->entity);
log_message("notice", "Zone Trigger 작업완료");
}
public function trigger(): ResponseInterface
public function webhook(): ResponseInterface
{
return $this->trigger_procedure();
return $this->webhook_procedure();
}
}