diff --git a/src/Site/Controller/Op.php b/src/Site/Controller/Op.php index e2c87cc..58c2f33 100644 --- a/src/Site/Controller/Op.php +++ b/src/Site/Controller/Op.php @@ -99,6 +99,7 @@ class Op { $tmpl->assign('data', $data->data); $tmpl->addCss('table'); + $tmpl->addCss('openprovider'); $tmpl->render('listcustomers'); exit(); @@ -115,7 +116,11 @@ class Op { 'additional_data' => [ 'company_registration_number' => $_POST['company_registration_number'] ?? '', 'company_url' => $_POST['company_url'] ?? '', - 'birth_date' => $_POST['birth_year'] !== '' && $_POST['birth_month'] !== '' && $_POST['birth_day'] !== '' ? $_POST['birth_year'].'-'.$_POST['birth_month'].'-'.$_POST['birth_day'] : '', + 'birth_date' => (isset($_POST['birth_year']) && $_POST['birth_year'] !== '') + && (isset($_POST['birth_month']) && $_POST['birth_month'] !== '') + && (isset($_POST['birth_day']) && $_POST['birth_day'] !== '') + ? $_POST['birth_year'].'-'.$_POST['birth_month'].'-'.$_POST['birth_day'] + : '', 'trading_name' => $_POST['company_name'] ?? '', ], 'address' => [ @@ -142,7 +147,10 @@ class Op { 'locale' => 'ja_JP', 'name' => [ 'first_name' => $_POST['first_name'] ?? '', - 'full_name' => $_POST['first_name'] !== '' && $_POST['last_name'] !== '' ? $_POST['first_name'].' '.$_POST['last_name'] : '', + 'full_name' => (isset($_POST['first_name']) && $_POST['first_name'] !== '') + && (isset($_POST['last_name']) && $_POST['last_name'] !== '') + ? $_POST['first_name'].' '.$_POST['last_name'] + : '', 'last_name' => $_POST['last_name'] ?? '', ], 'phone' => [ diff --git a/src/Std/Lib/Cache.php b/src/Std/Lib/Cache.php new file mode 100644 index 0000000..098ddbd --- /dev/null +++ b/src/Std/Lib/Cache.php @@ -0,0 +1,118 @@ +dataDir = $dataDir; + } + + /** + * キャッシュの作成 + * + * @param string $type キャッシュ類(例:login、domainlist等) + * @param array $data 保存するデータ + * @return Result + */ + public function set(string $type, array $data): Result { + if (!file_exists($this->dataDir)) { + if (!mkdir($this->dataDir, 0755)) + return Result::Error('エラー:ユーザーのアイコンディレクトリの作成に失敗。'); + } + + $data['lifespan'] = time(); + $json = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); + if (file_put_contents("{$this->dataDir}{$type}.json", $json) === false) return Result::Error('エラー:ユーザーデータの保存に失敗。'); + + return Result::Success(); + } + + /** + * キャッシュから受け取り + * + * @param string $type キャッシュ類(例:login、domainlist等) + * @return array + */ + public function get(string $type): array { + if (!file_exists("{$this->dataDir}{$type}.json")) return []; + + $content = file_get_contents("{$this->dataDir}{$type}.json"); + if ($content === false) return []; + + $data = json_decode($content, true); + if (json_last_error() !== JSON_ERROR_NONE || !is_array($data)) return []; + + return $data; + } + + /** + * キャッシュを破壊する + * + * @param string $name キャッシュのファイル名 + * @return Result + */ + public function murder(string $name): Result { + if (!file_exists("{$this->dataDir}{$name}.json")) return Result::Error('キャッシュファイルが存在しない。'); + if (!unlink("{$this->dataDir}{$name}.json")) return Result::Error('キャッシュファイルの削除に失敗。'); + return Result::Success(); + } + + /** + * キャッシュ有効期限の確認 + * + * @param array $cache + * @param mixed $data デフォルト=null + * @param string $dataPoint デフォルト=query + * @return bool + */ + public function validate(array $cache, mixed $data = null, string $dataPoint = 'query'): bool { + if (NULL === $data) return (!empty($cache) && (isset($cache['lifespan']) && time() < ($cache['lifespan'] + $this->dataDuration))); + else return (!empty($cache) + && (isset($cache[$dataPoint]) + && $cache[$dataPoint] === $data) + && (isset($cache['lifespan']) && time() < ($cache['lifespan'] + $this->dataDuration))); + } +} \ No newline at end of file diff --git a/src/Std/Lib/Openprovider.php b/src/Std/Lib/Openprovider.php index 53ab32d..d1e8e4b 100644 --- a/src/Std/Lib/Openprovider.php +++ b/src/Std/Lib/Openprovider.php @@ -37,14 +37,15 @@ OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Std\Lib; +use Std\Lib\Cache; use Std\Lib\Curl; use Result; class Openprovider { - protected string $dataDir = ROOT."/data/cache/openprovider/"; + protected string $cacheDir = ROOT."/data/cache/openprovider/"; protected int $tokenDuration = 172800; // 48時間 - protected int $dataDuration = 1800; // 30分 + private Cache $cache; private string $user = ''; private string $pass = ''; private string $token = ''; @@ -59,6 +60,7 @@ class Openprovider { $this->user = OPENPROVIDER['username']; $this->pass = OPENPROVIDER['password']; $this->ip = OPENPROVIDER['ip']; + $this->cache = new Cache($this->cacheDir); } /** @@ -70,7 +72,7 @@ class Openprovider { public function login(): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = 'login'; - $cache = $this->getCache($cacheName); + $cache = $this->cache->get($cacheName); if (time() < ($this->lastAuth + $this->tokenDuration)) { $this->token = $cache['data']['token']; $this->lastAuth = $cache['last_auth']; @@ -110,7 +112,7 @@ class Openprovider { $this->token = $res['data']['token']; $this->lastAuth = time(); $res['last_auth'] = $this->lastAuth; - $this->setCache($cacheName, $res); + $this->cache->set($cacheName, $res); return Result::Success('', $res); } @@ -150,14 +152,14 @@ class Openprovider { */ public function listDomains(array $query = []): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); - $cacheName = 'listdomains' - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache, $query)) return Result::Success('', $cache); + $cacheName = 'listdomains'; + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache, $query)) return Result::Success('', $cache); $curl = $this->setupCurl('/domains'); $res = $this->curlResult($curl); if (isset($res['data']['results'])) { - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res['data']['results']); } @@ -271,14 +273,14 @@ class Openprovider { if (isset($query['domain.extension'])) $ext = $query['domain.extension']; $cacheName = $name && $ext ? "domainadditionaldata-{$name}.{$ext}" : 'domainadditionaldata'; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache)) return Result::Success('', $cache); $uri = "/domains/additional-data?".http_build_query($query, '', '&', PHP_QUERY_RFC3986); $curl = $this->setupCurl($uri); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -302,14 +304,14 @@ class Openprovider { if (isset($query['domain.extension'])) $ext = $query['domain.extension']; $cacheName = $name && $ext ? "domainadditionaldata-{$name}.{$ext}" : 'domainadditionaldata'; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache)) return Result::Success('', $cache); $uri = "/domains/additional-data/customers?".http_build_query($query, '', '&', PHP_QUERY_RFC3986); $curl = $this->setupCurl($uri); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -333,14 +335,14 @@ class Openprovider { if (isset($query['domain.extension'])) $ext = $query['domain.extension']; $cacheName = $name && $ext ? "domainprices-{$name}.{$ext}" : 'domainprices'; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache)) return Result::Success('', $cache); $uri = "/domains/prices?".http_build_query($query, '', '&', PHP_QUERY_RFC3986); $curl = $this->setupCurl($uri); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -403,8 +405,8 @@ class Openprovider { public function listTlds(array $query = []): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = 'listtlds'; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache)) return Result::Success('', $cache); if (empty($query)) $query = [ 'limit' => 10, 'offset' => 0, 'order' => 'ASC' ]; foreach ($query as $k => $v) if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; @@ -413,7 +415,7 @@ class Openprovider { $curl = $this->setupCurl($uri); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -430,8 +432,8 @@ class Openprovider { public function getTld(string $tld, array $query = []): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = "gettld-{$tld}"; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache)) return Result::Success('', $cache); if (empty($query)) $query = [ 'limit' => 10, 'offset' => 0 ]; foreach ($query as $k => $v) if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; @@ -440,7 +442,7 @@ class Openprovider { $curl = $this->setupCurl($uri); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -460,8 +462,8 @@ class Openprovider { public function listInvoices(array $query = []): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = 'listinvoices'; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache)) return Result::Success('', $cache); if (empty($query)) $query = [ 'limit' => 10, 'offset' => 0 ]; foreach ($query as $k => $v) if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; @@ -470,7 +472,7 @@ class Openprovider { $curl = $this->setupCurl($uri); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -489,8 +491,8 @@ class Openprovider { public function listPayments(array $query = []): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = 'listpayments'; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache)) return Result::Success('', $cache); if (empty($query)) $query = [ 'limit' => 10, 'offset' => 0 ]; foreach ($query as $k => $v) if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; @@ -499,7 +501,7 @@ class Openprovider { $curl = $this->setupCurl($uri); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -518,8 +520,8 @@ class Openprovider { public function listTransactions(array $query = []): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = 'listtransactions'; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache)) return Result::Success('', $cache); if (empty($query)) $query = [ 'limit' => 10, 'offset' => 0 ]; foreach ($query as $k => $v) if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; @@ -528,7 +530,7 @@ class Openprovider { $curl = $this->setupCurl($uri); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -570,8 +572,8 @@ class Openprovider { public function listNameservers(array $query = []): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = 'listnameservers'; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache, $query)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache, $query)) return Result::Success('', $cache); if (empty($query)) $query = [ 'limit' => 25, 'offset' => 0, 'order_by.name' => 'asc' ]; foreach ($query as $k => $v) if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; @@ -580,7 +582,7 @@ class Openprovider { $curl = $this->setupCurl($uri); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -601,7 +603,7 @@ class Openprovider { $curl = $this->setupCurl($uri, 'POST', $payload); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache('listnameservers'); + $this->cache->murder('listnameservers'); return Result::Success('ネームサーバーの追加に成功。', $res->data); } @@ -619,8 +621,8 @@ class Openprovider { public function getNameserver(string $domain, array $query = []): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = "listnameserver-{$domain}"; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache)) return Result::Success('', $cache); if (empty($query)) $query = [ 'limit' => 100, 'offset' => 0, 'order_by.name' => 'asc' ]; foreach ($query as $k => $v) if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; @@ -629,7 +631,7 @@ class Openprovider { $curl = $this->setupCurl($uri); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -651,8 +653,8 @@ class Openprovider { $curl = $this->setupCurl($uri, 'PUT', $payload); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache('listnameservers'); - $this->murderCache("listnameserver-{$domain}"); + $this->cache->murder('listnameservers'); + $this->cache->murder("listnameserver-{$domain}"); if ($res->data['data']['success']) return Result::Success('ネームサーバーの更新に成功。', $res->data); } @@ -673,8 +675,8 @@ class Openprovider { $curl = $this->setupCurl($uri, 'DELETE'); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache('listnameservers'); - $this->murderCache("listnameserver-{$domain}"); + $this->cache->murder('listnameservers'); + $this->cache->murder("listnameserver-{$domain}"); if ($res->data['data']['success']) return Result::Success('ネームサーバーの削除に成功。', $res->data); } @@ -693,8 +695,8 @@ class Openprovider { public function listNsGroups(array $query = []): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = 'listnsgroups'; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache, $query)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache, $query)) return Result::Success('', $cache); if (empty($query)) $query = [ 'limit' => 25, 'offset' => 0, 'order_by.name' => 'asc' ]; foreach ($query as $k => $v) if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; @@ -703,7 +705,7 @@ class Openprovider { $curl = $this->setupCurl($uri); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -724,7 +726,7 @@ class Openprovider { $curl = $this->setupCurl($uri, 'POST', $payload); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache('listnsgroups'); + $this->cache->murder('listnsgroups'); return Result::Success('NSグループの追加に成功。', $res->data); } @@ -742,8 +744,8 @@ class Openprovider { public function getNsGroup(string $nsGroup, array $query = []): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = "listnsgroup-{$nsGroup}"; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache)) return Result::Success('', $cache); if (empty($query)) $query = [ 'limit' => 100, 'offset' => 0, 'order_by.name' => 'asc' ]; foreach ($query as $k => $v) if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; @@ -752,7 +754,7 @@ class Openprovider { $curl = $this->setupCurl($uri); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -774,8 +776,8 @@ class Openprovider { $curl = $this->setupCurl($uri, 'PUT', $payload); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache('listnsgroups'); - $this->murderCache("listnsgroup-{$nsGroup}"); + $this->cache->murder('listnsgroups'); + $this->cache->murder("listnsgroup-{$nsGroup}"); if ($res->data['data']['success']) return Result::Success('NSグループの更新に成功。', $res->data); } @@ -796,8 +798,8 @@ class Openprovider { $curl = $this->setupCurl($uri, 'DELETE'); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache('listnsgroups'); - $this->murderCache("listnsgroup-{$nsGroup}"); + $this->cache->murder('listnsgroups'); + $this->cache->murder("listnsgroup-{$nsGroup}"); if ($res->data['data']['success']) return Result::Success('NSグループの削除に成功。', $res->data); } @@ -816,8 +818,8 @@ class Openprovider { public function listDnsTemplate(array $query = []): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = 'listdnstemplates'; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache, $query)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache, $query)) return Result::Success('', $cache); foreach ($query as $k => $v) { if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; } $uri = '/dns/templates?'.http_build_query($query, '', '&', PHP_QUERY_RFC3986); @@ -825,7 +827,7 @@ class Openprovider { $res = $this->curlResult($curl); if (isset($res->data['data'])) { $res->data['query'] = $query; - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -846,7 +848,7 @@ class Openprovider { $curl = $this->setupCurl($uri, 'POST', $payload); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache('listdnstemplates'); + $this->cache->murder('listdnstemplates'); return Result::Success('DNSテンプレートの追加に成功。', $res->data); } @@ -863,14 +865,14 @@ class Openprovider { public function getDnsTemplate(int $id): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = "getdnstemplate-{$id}"; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache, $query)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache, $query)) return Result::Success('', $cache); $uri = "/dns/templates/{$id}"; $curl = $this->setupCurl($uri); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -891,8 +893,8 @@ class Openprovider { $curl = $this->setupCurl($uri, 'DELETE'); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache('listdnstemplates'); - $this->murderCache("getdnstemplate-{$id}"); + $this->cache->murder('listdnstemplates'); + $this->cache->murder("getdnstemplate-{$id}"); if ($res->data['data']['success']) return Result::Success('DNSテンプレートの削除に成功。', $res->data); } @@ -910,8 +912,8 @@ class Openprovider { public function listDnsZones(array $query = []): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = 'listdnszones'; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache, $query)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache, $query)) return Result::Success('', $cache); if (empty($query)) $query = [ 'limit' => 25, 'offset' => 0, 'order_by.name' => 'asc' ]; foreach ($query as $k => $v) if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; @@ -920,7 +922,7 @@ class Openprovider { $curl = $this->setupCurl($uri); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -941,7 +943,7 @@ class Openprovider { $curl = $this->setupCurl($uri, 'POST', $payload); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache('listdnszones'); + $this->cache->murder('listdnszones'); return Result::Success('DNSゾーンの追加に成功。', $res->data); } @@ -958,8 +960,8 @@ class Openprovider { public function getDnsZone(string $domain, array $query = []): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = "getdnszone-{$domain}"; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache)) return Result::Success('', $cache); if (empty($query)) $query = [ 'limit' => 100, 'offset' => 0, 'order_by.name' => 'asc' ]; foreach ($query as $k => $v) if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; @@ -968,7 +970,7 @@ class Openprovider { $curl = $this->setupCurl($uri); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -990,8 +992,8 @@ class Openprovider { $curl = $this->setupCurl($uri, 'PUT', $payload); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache('listdnszones'); - $this->murderCache("getdnszone-{$domain}"); + $this->cache->murder('listdnszones'); + $this->cache->murder("getdnszone-{$domain}"); if ($res->data['data']['success']) return Result::Success('DNSゾーンの更新に成功。', $res->data); } @@ -1012,8 +1014,8 @@ class Openprovider { $curl = $this->setupCurl($uri, 'DELETE'); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache('listdnszones'); - $this->murderCache("getdnszone-{$domain}"); + $this->cache->murder('listdnszones'); + $this->cache->murder("getdnszone-{$domain}"); if ($res->data['data']['success']) return Result::Success('DNSゾーンの削除に成功。', $res->data); } @@ -1031,13 +1033,13 @@ class Openprovider { public function listZoneRecords(string $domain): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = "getzonerecords-{$domain}"; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache)) return Result::Success('', $cache); $curl = $this->setupCurl("/dns/zones/{$domain}/records"); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -1060,8 +1062,8 @@ class Openprovider { public function listEmails(array $query = []): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = 'listemails'; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache, $query)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache, $query)) return Result::Success('', $cache); foreach ($query as $k => $v) { if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; } $uri = '/emails?'.http_build_query($query, '', '&', PHP_QUERY_RFC3986); @@ -1069,7 +1071,7 @@ class Openprovider { $res = $this->curlResult($curl); if (isset($res->data['data'])) { $res->data['query'] = $query; - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -1090,7 +1092,7 @@ class Openprovider { $curl = $this->setupCurl($uri, 'POST', $payload); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache('listemails'); + $this->cache->murder('listemails'); return Result::Success('メールテンプレートの追加に成功。', $res->data); } @@ -1112,7 +1114,7 @@ class Openprovider { $curl = $this->setupCurl($uri, 'PUT', $payload); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache('listemails'); + $this->cache->murder('listemails'); if ($res->data['data']['success']) return Result::Success('メールテンプレートの更新に成功。', $res->data); } @@ -1133,7 +1135,7 @@ class Openprovider { $curl = $this->setupCurl($uri, 'DELETE'); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache('listemails'); + $this->cache->murder('listemails'); if ($res->data['data']['success']) return Result::Success('メールテンプレートの削除に成功。', $res->data); } @@ -1155,8 +1157,8 @@ class Openprovider { public function listContacts(array $query = []): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = 'listcontacts'; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache, $query)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache, $query)) return Result::Success('', $cache); foreach ($query as $k => $v) { if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; } $uri = '/contacts?'.http_build_query($query, '', '&', PHP_QUERY_RFC3986); @@ -1164,7 +1166,7 @@ class Openprovider { $res = $this->curlResult($curl); if (isset($res->data['data'])) { $res->data['query'] = $query; - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -1184,7 +1186,7 @@ class Openprovider { $curl = $this->setupCurl($uri, 'POST', $payload); $res = $this->curlResult($curl); if (isset($res)) { - $this->murderCache('listcontacts'); + $this->cache->murder('listcontacts'); return Result::Success('', $res->data); } @@ -1201,8 +1203,8 @@ class Openprovider { public function getContact(int $id, bool $withAdditionalData = false): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = "getcontact-{$id}"; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache, $id, 'id')) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache, $id, 'id')) return Result::Success('', $cache); $query = [ 'with_additional_data' => $withAdditionalData ? 'true' : 'false' ]; $uri = "/contacts/{$id}?".http_build_query($query, '', '&', PHP_QUERY_RFC3986); @@ -1211,7 +1213,7 @@ class Openprovider { $res = $this->curlResult($curl); if (isset($res->data['data'])) { $res->data['id'] = $id; - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -1233,8 +1235,8 @@ class Openprovider { $curl = $this->setupCurl($uri, 'PUT', $payload); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache("getcontact-{$id}"); - $this->murderCache('listcontacts'); + $this->cache->murder("getcontact-{$id}"); + $this->cache->murder('listcontacts'); if ($res->data['data']['success']) return Result::Success('連絡先の更新に成功。', $res->data); } @@ -1254,8 +1256,8 @@ class Openprovider { $curl = $this->setupCurl($uri, 'DELETE'); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache("getcontact-{$id}"); - $this->murderCache('listcontacts'); + $this->cache->murder("getcontact-{$id}"); + $this->cache->murder('listcontacts'); if ($res->data['data']['success']) return Result::Success('連絡先の削除に成功。'); } @@ -1273,8 +1275,8 @@ class Openprovider { public function listCustomers(array $query = []): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = 'listcustomers'; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache, $query)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache, $query)) return Result::Success('', $cache); foreach ($query as $k => $v) { if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; } $uri = '/customers?'.http_build_query($query, '', '&', PHP_QUERY_RFC3986); @@ -1282,7 +1284,7 @@ class Openprovider { $res = $this->curlResult($curl); if (isset($res->data['data'])) { $res->data['query'] = $query; - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -1302,7 +1304,7 @@ class Openprovider { $curl = $this->setupCurl($uri, 'POST', $payload); $res = $this->curlResult($curl); if (isset($res)) { - $this->murderCache('listcustomers'); + $this->cache->murder('listcustomers'); return Result::Success('', $res->data); } @@ -1319,8 +1321,8 @@ class Openprovider { public function getCustomer(string $handle, bool $withAdditionalData = false): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = "getcustomer-{$handle}"; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache, $handle, 'handle')) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache, $handle, 'handle')) return Result::Success('', $cache); $query = [ 'with_additional_data' => $withAdditionalData ? 'true' : 'false' ]; $uri = "/customers/{$handle}?".http_build_query($query, '', '&', PHP_QUERY_RFC3986); @@ -1329,7 +1331,7 @@ class Openprovider { $res = $this->curlResult($curl); if (isset($res->data['data'])) { $res->data['handle'] = $handle; - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -1351,7 +1353,8 @@ class Openprovider { $curl = $this->setupCurl($uri, 'PUT', $payload); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache('listcustomers'); + $this->cache->murder('listcustomers'); + $this->cache->murder("getcustomer-{$handle}"); if ($res->data['data']['success']) return Result::Success('顧客様の更新に成功。', $res->data); } @@ -1371,7 +1374,8 @@ class Openprovider { $curl = $this->setupCurl($uri, 'DELETE'); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache('listcustomers'); + $this->cache->murder('listcustomers'); + $this->cache->murder("getcustomer-{$handle}"); if ($res->data['data']['success']) return Result::Success('顧客様の削除に成功。'); } @@ -1390,8 +1394,8 @@ class Openprovider { public function listEmailVerifications(array $query = []): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = 'listemailverifications'; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache, $query)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache, $query)) return Result::Success('', $cache); foreach ($query as $k => $v) { if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; } $uri = '/customers/verifications/emails/domains?'.http_build_query($query, '', '&', PHP_QUERY_RFC3986); @@ -1399,7 +1403,7 @@ class Openprovider { $res = $this->curlResult($curl); if (isset($res->data['data'])) { $res->data['query'] = $query; - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -1420,7 +1424,7 @@ class Openprovider { $curl = $this->setupCurl($uri, 'POST', ['email' => $email, 'language' => $language, 'tag' => $tag]); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache('listemailverifications'); + $this->cache->murder('listemailverifications'); return Result::Success('メール認証の再起動に成功。', $res->data); } @@ -1444,7 +1448,7 @@ class Openprovider { $curl = $this->setupCurl($uri, 'POST', ['email' => $email, 'handle' => $handle, 'language' => $language, 'tag' => $tag]); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache('listemailverifications'); + $this->cache->murder('listemailverifications'); return Result::Success('メール認証の起動に成功。', $res->data); } @@ -1463,8 +1467,8 @@ class Openprovider { public function getReseller(array $query = []): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = 'getreseller'; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache, $query)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache, $query)) return Result::Success('', $cache); foreach ($query as $k => $v) { if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; } $uri = '/resellers?'.http_build_query($query, '', '&', PHP_QUERY_RFC3986); @@ -1472,7 +1476,7 @@ class Openprovider { $res = $this->curlResult($curl); if (isset($res->data['data'])) { $res->data['query'] = $query; - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -1494,7 +1498,7 @@ class Openprovider { $curl = $this->setupCurl($uri, 'PUT', $payload); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache('getreseller'); + $this->cache->murder('getreseller'); if ($res->data['data']['success']) return Result::Success('リセラーの更新に成功。', $res->data); } @@ -1512,15 +1516,15 @@ class Openprovider { public function listSettings(): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = 'listsettings'; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache, $query)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache, $query)) return Result::Success('', $cache); $uri = '/resellers/settings'; $curl = $this->setupCurl($uri); $res = $this->curlResult($curl); if (isset($res->data['data'])) { $res->data['query'] = $query; - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -1538,15 +1542,15 @@ class Openprovider { public function listStatistics(array $query = []): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = 'liststatistics'; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache, $query)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache, $query)) return Result::Success('', $cache); $uri = '/resellers/statistics'; $curl = $this->setupCurl($uri); $res = $this->curlResult($curl); if (isset($res->data['data'])) { $res->data['query'] = $query; - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -1565,8 +1569,8 @@ class Openprovider { public function listTags(array $query = []): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = 'listtags'; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache, $query)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache, $query)) return Result::Success('', $cache); foreach ($query as $k => $v) { if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; } $uri = '/tags?'.http_build_query($query, '', '&', PHP_QUERY_RFC3986); @@ -1574,7 +1578,7 @@ class Openprovider { $res = $this->curlResult($curl); if (isset($res->data['data'])) { $res->data['query'] = $query; - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -1595,7 +1599,7 @@ class Openprovider { $curl = $this->setupCurl($uri, 'POST', $payload); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache('listtags'); + $this->cache->murder('listtags'); return Result::Success('タグの追加に成功。', $res->data); } @@ -1616,7 +1620,7 @@ class Openprovider { $curl = $this->setupCurl($uri, 'DELETE', $payload); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache('listtags'); + $this->cache->murder('listtags'); if ($res->data['data']['success']) return Result::Success('タグの削除に成功。', $res->data); } @@ -1641,7 +1645,7 @@ class Openprovider { $curl = $this->setupCurl($uri, 'POST', $payload); $res = $this->curlResult($curl); if (isset($res)) { - $this->murderCache('listdomains'); + $this->cache->murder('listdomains'); return Result::Success('', $res->data); } @@ -1659,8 +1663,8 @@ class Openprovider { public function getSeDomain(string $domain, array $query = []): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = "getsedomain-{$domain}"; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache, $domain, 'domain')) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache, $domain, 'domain')) return Result::Success('', $cache); $uri = "/spam-expert/domains/{$domain}?".http_build_query($query, '', '&', PHP_QUERY_RFC3986); // kys($uri); @@ -1668,7 +1672,7 @@ class Openprovider { $res = $this->curlResult($curl); if (isset($res->data['data'])) { $res->data['domain'] = $domain; - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -1690,8 +1694,8 @@ class Openprovider { $curl = $this->setupCurl($uri, 'PUT', $payload); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache('listdomains'); - $this->murderCache("getsedomain-{$domain}"); + $this->cache->murder('listdomains'); + $this->cache->murder("getsedomain-{$domain}"); if ($res->data['data']['success']) return Result::Success('SEDomainの更新に成功。', $res->data); } @@ -1712,8 +1716,8 @@ class Openprovider { $curl = $this->setupCurl($uri, 'DELETE'); $res = $this->curlResult($curl); if (isset($res->data['data'])) { - $this->murderCache('listdomains'); - $this->murderCache("getsedomain-{$domain}"); + $this->cache->murder('listdomains'); + $this->cache->murder("getsedomain-{$domain}"); if ($res->data['data']['success']) return Result::Success('SEDomainの削除に成功。'); } @@ -1734,8 +1738,8 @@ class Openprovider { public function listApproverEmails(array $query = []): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = 'listapproveremails'; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache, $query)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache, $query)) return Result::Success('', $cache); foreach ($query as $k => $v) { if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; } $uri = '/ssl/approver-emails?'.http_build_query($query, '', '&', PHP_QUERY_RFC3986); @@ -1743,7 +1747,7 @@ class Openprovider { $res = $this->curlResult($curl); if (isset($res->data['data'])) { $res->data['query'] = $query; - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -1811,7 +1815,7 @@ class Openprovider { $curl = $this->setupCurl($uri, 'PUT', ['id' => $id, 'approver_email' => $approverEmail]); $res = $this->curlResult($curl); if (isset($res)) { - $this->murderCache('listapproveremails'); + $this->cache->murder('listapproveremails'); return Result::Success('', $res->data); } @@ -1832,7 +1836,7 @@ class Openprovider { $curl = $this->setupCurl($uri, 'POST', ['id' => $id]); $res = $this->curlResult($curl); if (isset($res)) { - $this->murderCache('listapproveremails'); + $this->cache->murder('listapproveremails'); return Result::Success('', $res->data); } @@ -1873,8 +1877,8 @@ class Openprovider { public function listSslProducts(array $query = []): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = 'listsslproducts'; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache, $query)) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache, $query)) return Result::Success('', $cache); foreach ($query as $k => $v) { if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; } $uri = '/ssl/products?'.http_build_query($query, '', '&', PHP_QUERY_RFC3986); @@ -1882,7 +1886,7 @@ class Openprovider { $res = $this->curlResult($curl); if (isset($res->data['data'])) { $res->data['query'] = $query; - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -1899,14 +1903,14 @@ class Openprovider { public function getSslProduct(int $id): Result { if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。'); $cacheName = "getsslproduct-{$id}"; - $cache = $this->getCache($cacheName); - if ($this->isValidLifespan($cache, $id, 'id')) return Result::Success('', $cache); + $cache = $this->cache->get($cacheName); + if ($this->cache->validate($cache, $id, 'id')) return Result::Success('', $cache); // kys($uri); $curl = $this->setupCurl($uri); $res = $this->curlResult($curl); if (isset($res->data['data'])) { $res->data['id'] = $id; - $this->setCache($cacheName, $res->data); + $this->cache->set($cacheName, $res->data); return Result::Success('', $res->data); } @@ -1968,75 +1972,4 @@ class Openprovider { return Result::Success('', json_decode($body, true)); } - - /** - * キャッシュの作成 - * - * @param string $type キャッシュ類(例:login、domainlist等) - * @param array $data 保存するデータ - * @return Result - */ - private function setCache(string $type, array $data): Result { - if (!file_exists($this->dataDir)) { - if (!mkdir($this->dataDir, 0755)) - return Result::Error('エラー:ユーザーのアイコンディレクトリの作成に失敗。'); - } - - $data['lifespan'] = time(); - $json = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); - if (file_put_contents("{$this->dataDir}{$type}.json", $json) === false) return Result::Error('エラー:ユーザーデータの保存に失敗。'); - - return Result::Success(); - } - - /** - * キャッシュから受け取り - * - * @param string $type キャッシュ類(例:login、domainlist等) - * @return array - */ - private function getCache(string $type): array { - if (!file_exists("{$this->dataDir}{$type}.json")) return []; - - $content = file_get_contents("{$this->dataDir}{$type}.json"); - if ($content === false) return []; - - $data = json_decode($content, true); - if (json_last_error() !== JSON_ERROR_NONE || !is_array($data)) return []; - - if ($type === 'login') { - $this->token = $data['data']['token']; - $this->lastAuth = $data['last_auth']; - } - - return $data; - } - - /** - * キャッシュを破壊する - * - * @param string $name キャッシュのファイル名 - * @return Result - */ - private function murderCache(string $name): Result { - if (!file_exists("{$this->dataDir}{$name}.json")) return Result::Error('キャッシュファイルが存在しない。'); - if (!unlink("{$this->dataDir}{$name}.json")) return Result::Error('キャッシュファイルの削除に失敗。'); - return Result::Success(); - } - - /** - * キャッシュ有効期限の確認 - * - * @param array $cache - * @param mixed $data デフォルト=null - * @param string $dataPoint デフォルト=query - * @return bool - */ - private function isValidLifespan(array $cache, mixed $data = null, string $dataPoint = 'query'): bool { - if (NULL === $data) return (!empty($cache) && (isset($cache['lifespan']) && time() < ($cache['lifespan'] + $this->dataDuration))); - else return (!empty($cache) - && (isset($cache[$dataPoint]) - && $cache[$dataPoint] === $data) - && (isset($cache['lifespan']) && time() < ($cache['lifespan'] + $this->dataDuration))); - } } \ No newline at end of file diff --git a/view/openprovider/createcustomer.maron b/view/openprovider/createcustomer.maron index ac579d4..6e5ef22 100644 --- a/view/openprovider/createcustomer.maron +++ b/view/openprovider/createcustomer.maron @@ -108,5 +108,4 @@

- {@ kys($data) @} {@ include(common/footer) @} \ No newline at end of file diff --git a/view/openprovider/listcustomers.maron b/view/openprovider/listcustomers.maron index ebea5b4..10ae7e8 100644 --- a/view/openprovider/listcustomers.maron +++ b/view/openprovider/listcustomers.maron @@ -1,5 +1,5 @@ {@ include(common/header) @} - 顧客様の追加
+ 顧客様の追加
検索
{@ if (isset($data['data']['results'])) @}