change CLITools...1
This commit is contained in:
parent
8eb87ebf43
commit
95f5246c7b
@ -2,21 +2,19 @@
|
||||
|
||||
namespace App\Controllers\CLI\Cloudflare\API;
|
||||
|
||||
use App\Entities\Cloudflare\API\AccountEntity;
|
||||
use App\Libraries\Log\Log;
|
||||
|
||||
class Account extends API
|
||||
{
|
||||
private function getAccounts(int $account_uid): array
|
||||
private function getAccounts(int $account_uid = 0): array
|
||||
{
|
||||
$this->getAccountModel()->where(['status' => 'active']);
|
||||
$wheres = ['status' => 'use'];
|
||||
if ($account_uid) {
|
||||
$this->getAccountModel()->where(['account_uid' => $account_uid]);
|
||||
} else {
|
||||
$this->getAccountModel()->where(['status' => 'use']);
|
||||
$wheres = ['account_uid' => $account_uid];
|
||||
}
|
||||
$entitys = $this->getAccountModel()->getEntitys($wheres);
|
||||
Log::add("error", __FUNCTION__ . "에서 호출:" . $this->getAccountModel()->getLastQuery());
|
||||
return $this->getAccountModel()->asObject(AccountEntity::class)->findAll();
|
||||
return $entitys;
|
||||
}
|
||||
final public function execute($auth_uid = 0, $page_limit = 0)
|
||||
{
|
||||
|
||||
@ -12,8 +12,8 @@ class Auth extends API
|
||||
//transation처리
|
||||
// $this->getAuthModel()->db->transBegin();
|
||||
try {
|
||||
$entitys = $this->getAuthModel()->asObject(AuthEntity::class)->where(['status' => 'use'])->findAll();
|
||||
foreach ($entitys as $entity) {
|
||||
Log::add("error", __METHOD__ . "에서 Account Reload 시작");
|
||||
foreach ($this->getAuthModel()->getEntitys(['status' => 'use']) as $entity) {
|
||||
$api = new \App\Libraries\Cloudflare\API\Account($entity);
|
||||
$api->reload();
|
||||
}
|
||||
|
||||
@ -2,20 +2,21 @@
|
||||
|
||||
namespace App\Controllers\CLI\Cloudflare\API;
|
||||
|
||||
use App\Entities\Cloudflare\API\ZoneEntity;
|
||||
use App\Libraries\Log\Log;
|
||||
|
||||
class Zone extends API
|
||||
{
|
||||
private function getZones(string $account_uid): array
|
||||
private function getZones(string $account_uid = ''): array
|
||||
{
|
||||
$wheres = ['status' => 'active'];
|
||||
if ($account_uid) {
|
||||
$this->getZoneModel()->where(['account_uid' => $account_uid]);
|
||||
} else {
|
||||
$this->getZoneModel()->where(['status' => 'active']);
|
||||
$wheres = ['account_uid' => $account_uid];
|
||||
}
|
||||
$entitys = $this->getZoneModel()->getEntitys($wheres);
|
||||
// dd($this->getZoneModel()->getLastQuery());
|
||||
Log::add("error", __FUNCTION__ . "에서 호출:" . $this->getZoneModel()->getLastQuery());
|
||||
return $this->getZoneModel()->asObject(ZoneEntity::class)->findAll();
|
||||
// dd($entitys);
|
||||
return $entitys;
|
||||
}
|
||||
final public function record($account_uid = '', $page_limit = 0,)
|
||||
{
|
||||
|
||||
@ -50,7 +50,7 @@ class AccountModel extends Model
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
public function getEntity(string $uid): null|AccountEntity
|
||||
public function getEntity(string $uid): AccountEntity
|
||||
{
|
||||
$entity = $this->asObject(AccountEntity::class)->where('uid', $uid)->first();
|
||||
if (is_null($entity)) {
|
||||
@ -58,6 +58,10 @@ class AccountModel extends Model
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
public function getEntitys(array $wheres)
|
||||
{
|
||||
return $this->asObject(AccountEntity::class)->where($wheres)->findAll();
|
||||
}
|
||||
|
||||
//Account Status
|
||||
public function setStatusByAuth(int $auth_uid, $status)
|
||||
|
||||
@ -49,7 +49,7 @@ class AuthModel extends Model
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
public function getEntity(string $uid): null|AuthEntity
|
||||
public function getEntity(string $uid): AuthEntity
|
||||
{
|
||||
$entity = $this->asObject(AuthEntity::class)->where('uid', $uid)->first();
|
||||
if (is_null($entity)) {
|
||||
@ -57,6 +57,10 @@ class AuthModel extends Model
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
public function getEntitys(array $wheres)
|
||||
{
|
||||
return $this->asObject(AuthEntity::class)->where($wheres)->findAll();
|
||||
}
|
||||
|
||||
//Index 검색용
|
||||
public function setIndexWordFilter(string $word)
|
||||
|
||||
@ -59,7 +59,7 @@ class FirewallModel extends Model
|
||||
return $this->table;
|
||||
}
|
||||
|
||||
public function getEntity(string $uid): null|FirewallEntity
|
||||
public function getEntity(string $uid): FirewallEntity
|
||||
{
|
||||
$entity = $this->asObject(FirewallEntity::class)->where("uid", $uid)->first();
|
||||
if (is_null($entity)) {
|
||||
|
||||
@ -62,7 +62,7 @@ class RecordModel extends Model
|
||||
return $this->table;
|
||||
}
|
||||
|
||||
public function getEntity(string $uid): null|RecordEntity
|
||||
public function getEntity(string $uid): RecordEntity
|
||||
{
|
||||
$entity = $this->asObject(RecordEntity::class)->where('uid', $uid)->first();
|
||||
if (is_null($entity)) {
|
||||
|
||||
@ -61,7 +61,7 @@ class ZoneModel extends Model
|
||||
return $this->table;
|
||||
}
|
||||
|
||||
public function getEntity(string $uid): null|ZoneEntity
|
||||
public function getEntity(string $uid): ZoneEntity
|
||||
{
|
||||
$entity = $this->asObject(ZoneEntity::class)->where('uid', $uid)->first();
|
||||
if (is_null($entity)) {
|
||||
@ -69,6 +69,10 @@ class ZoneModel extends Model
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
public function getEntitys(array $wheres)
|
||||
{
|
||||
return $this->asObject(ZoneEntity::class)->where($wheres)->findAll();
|
||||
}
|
||||
|
||||
//Index 검색용
|
||||
public function setIndexWordFilter(string $word)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user