39 lines
1.3 KiB
PHP
39 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers\CLI\Cloudflare\API;
|
|
|
|
use App\Libraries\Log\Log;
|
|
|
|
class Account extends API
|
|
{
|
|
private function getAccounts(int $account_uid = 0): array
|
|
{
|
|
$wheres = ['status' => 'use'];
|
|
if ($account_uid) {
|
|
$wheres = ['account_uid' => $account_uid];
|
|
}
|
|
$entitys = $this->getAccountModel()->getEntitys($wheres);
|
|
Log::add("error", __FUNCTION__ . "에서 호출:" . $this->getAccountModel()->getLastQuery());
|
|
return $entitys;
|
|
}
|
|
final public function execute($auth_uid = 0, $page_limit = 0)
|
|
{
|
|
//transation처리
|
|
// $this->getAccountModel()->db->transBegin();
|
|
try {
|
|
//Zone 처리
|
|
foreach ($this->getAccounts((int)$auth_uid) as $entity) {
|
|
$api = new \App\Libraries\Cloudflare\API\Zone($entity, true);
|
|
$api->reload((int)$page_limit);
|
|
}
|
|
//transation 완료
|
|
// $this->getAccountModel()->db->transCommit();
|
|
Log::add("error", __METHOD__ . "에서 Zone Reload 완료");
|
|
} catch (\Exception $e) {
|
|
// transaction 오류복구
|
|
// $this->getAccountModel()->db->transRollback();
|
|
Log::add("error", __METHOD__ . "에서 Zone Reload 오류\n" . $e->getMessage());
|
|
}
|
|
}
|
|
}
|