From 9c753e5d09cf13e5cc520bee1d4fb85d13783de1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AB=8F=E8=A8=AA=E5=AD=90?= Date: Mon, 27 Apr 2026 20:12:54 +0900 Subject: [PATCH] =?UTF-8?q?=E9=A1=A7=E5=AE=A2=E6=A7=98=E3=81=AE=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- route.php | 3 +- src/Site/Controller/Op.php | 42 ++++++- src/Std/Lib/Openprovider.php | 31 ++++- view/openprovider/getcustomer.maron | 112 ++++++++++++++++++ view/openprovider/index.maron | 2 +- ...listcustomer.maron => listcustomers.maron} | 1 + 6 files changed, 186 insertions(+), 5 deletions(-) create mode 100644 view/openprovider/getcustomer.maron rename view/openprovider/{listcustomer.maron => listcustomers.maron} (93%) diff --git a/route.php b/route.php index 2b099ae..f51cf21 100644 --- a/route.php +++ b/route.php @@ -60,7 +60,8 @@ if (ATOM_ENABLED) { if (OPENPROVIDER_ENABLED) { $routes[] = Route::add('GET', 'openprovider', Op::class.'@index'); - $routes[] = Route::add('GET', 'openprovider/listcustomer', Op::class.'@opListCustomers'); + $routes[] = Route::add('GET', 'openprovider/listcustomers', Op::class.'@opListCustomers'); + $routes[] = Route::add('GET', 'openprovider/getcustomer/{handle}', Op::class.'@opGetCustomer'); $routes[] = Route::add('GET', 'openprovider/listtlds', Op::class.'@opListTlds'); $routes[] = Route::add('GET', 'openprovider/gettld/{tld}', Op::class.'@opGetTld'); $routes[] = Route::add('GET', 'openprovider/checkdomain', Op::class.'@opCheckDomainAvailable'); diff --git a/src/Site/Controller/Op.php b/src/Site/Controller/Op.php index fe371a9..5f7bee2 100644 --- a/src/Site/Controller/Op.php +++ b/src/Site/Controller/Op.php @@ -63,7 +63,47 @@ class Op { $tmpl->assign('data', $data->data); $tmpl->addCss('table'); - $tmpl->render('listcustomer'); + $tmpl->render('listcustomers'); + exit(); + + noaccess: + $tmpl->render('nopermission'); + } catch (\Exception $e) { + throw new \Exception($e->getMessage()); + } + } + + public function opGetCustomer(array $params): void { + try { + $handle = ''; + if (isset($params['handle'])) $handle = $params['handle']; + if ($handle === '') { + header('Location: /openprovider/listcustomers'); + exit(); + } + $tmpl = new Template('/openprovider/'); + $pagetit = "OpenProvider管理 - 顧客様「{$handle}」の表示"; + $description = ''; + + // ユーザー + $auth = new Auth(); + $user = $auth->getLoggedInUser(); + $tmpl->assign('user', $user); + + $tmpl->assign('pagetit', $pagetit); + $tmpl->assign('curPage', 'openprovider'); + $tmpl->assign('custCss', true); + $tmpl->assign('menu', $this->getMenu()); + $tmpl->assign('description', $description); + + if (!$user || $user->role !== \Roles::ADMIN) goto noaccess; + $op = new Openprovider(); + $op->login(); + $data = $op->getCustomer($handle, true); + $tmpl->assign('data', $data->data); + + $tmpl->addCss('table'); + $tmpl->render('getcustomer'); exit(); noaccess: diff --git a/src/Std/Lib/Openprovider.php b/src/Std/Lib/Openprovider.php index c1ffbd0..bd9c782 100644 --- a/src/Std/Lib/Openprovider.php +++ b/src/Std/Lib/Openprovider.php @@ -199,7 +199,7 @@ class Openprovider { //// 顧客様の追加データ /** - * 顧客様の検索 + * 顧客様の一覧 * * @param array $query 検索クエリー * @return Result @@ -219,7 +219,34 @@ class Openprovider { return \Result::Success('', $res->data); } - return \Result::Error('TLD一覧の受け取りに失敗。'); + return \Result::Error('顧客様一覧の受け取りに失敗。'); + } + + /** + * 顧客様の表示 + * + * @param string $handle ハンドル + * @param bool $withAdditionalData 詳細データ含むか? + * @return Result + */ + public function getCustomer(string $handle, bool $withAdditionalData = false): \Result { + if (!OPENPROVIDER_ENABLED) return \Result::error('エラー:OpenProviderは無効です。'); + $cacheName = "getcustomer-{$handle}"; + $cache = $this->getCache($cacheName); + if (!empty($cache) && (isset($cache['handle']) && $cache['handle'] === $handle)) return \Result::Success('', $cache); + + $query = [ 'with_additional_data' => $withAdditionalData ? 'true' : 'false' ]; + $uri = "/customers/{$handle}?".http_build_query($query, '', '&', PHP_QUERY_RFC3986); + // kys($uri); + $curl = $this->setupCurl($uri); + $res = $this->curlResult($curl); + if (isset($res->data['data'])) { + $res->data['handle'] = $handle; + $this->setCache($cacheName, $res->data); + return \Result::Success('', $res->data); + } + + return \Result::Error('顧客様の受け取りに失敗。'); } //// ドメイン値段 diff --git a/view/openprovider/getcustomer.maron b/view/openprovider/getcustomer.maron new file mode 100644 index 0000000..af94748 --- /dev/null +++ b/view/openprovider/getcustomer.maron @@ -0,0 +1,112 @@ +{@ include(common/header) @} + 顧客様の削除
+ 顧客様のクローン
+ 顧客様の編集
+

連絡先:{{ $data['data']['name']['full_name'] }} ({{ $data['data']['handle'] }})

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ID{{ $data['data']['id'] }}
リセラーID{{ $data['data']['reseller_id'] }}
ハンドル{{ $data['data']['handle'] }}
イニシャル
フルネーム{{ $data['data']['name']['last_name'].' '.$data['data']['name']['first_name'] }}
生まれた場所〒{{ $data['data']['additional_data']['birth_zipcode'].' '.$data['data']['additional_data']['birth_city'].' '.$data['data']['additional_data']['birth_address'].' '.$data['data']['additional_data']['birth_country'] }}
生年月日{{ $data['data']['additional_data']['birth_date'] }}
電話番号{{ $data['data']['phone']['country_code'].$data['data']['phone']['area_code'].$data['data']['phone']['subscriber_number'] }}
FAX{{ $data['data']['fax']['country_code'].$data['data']['fax']['area_code'].$data['data']['fax']['subscriber_number'] }}
メールアドレス{{ $data['data']['email'] }}
+

会社情報

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
会社名{{ $data['data']['company_name'] }}
VAT番号{{ $data['data']['vat'] }}
会社登録番号{{ $data['data']['additional_data']['company_registration_number'] }}
会社登録場所{{ $data['data']['additional_data']['company_registration_city'] }}
会社登録日{{ $data['data']['additional_data']['company_registration_subscription_date'] }}
会社URL{{ $data['data']['additional_data']['company_url'] }}
+

住所情報

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
道+番号{{ $data['data']['address']['street'].$data['data']['address']['number'].' '.$data['data']['address']['suffix'] }}
郵便番号{{ $data['data']['address']['zipcode'] }}
市区町村{{ $data['data']['address']['city'] }}
都道府県{{ $data['data']['address']['state'] }}
{{ $data['data']['address']['country'] }}
言語{{ $data['data']['locale'] }}
本社の場所〒{{ $data['data']['additional_data']['headquarters_zipcode'].' '.$data['data']['additional_data']['headquarters_city'].' '.$data['data']['additional_data']['headquarters_address'].' '.$data['data']['additional_data']['headquarters_country'] }}
+{@ include(common/footer) @} \ No newline at end of file diff --git a/view/openprovider/index.maron b/view/openprovider/index.maron index 78f4bf4..81d36f9 100644 --- a/view/openprovider/index.maron +++ b/view/openprovider/index.maron @@ -3,7 +3,7 @@