From fde40b0499e50fc2c5d64167f6bdb7d461aaf673 Mon Sep 17 00:00:00 2001 From: "sosuke.iwabuchi" Date: Mon, 9 Jun 2025 10:00:03 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B5=E3=83=BC=E3=83=93=E3=82=B9=E5=88=B8?= =?UTF-8?q?=E6=96=87=E5=AD=97=E5=88=97=E3=81=AE=E5=BE=A9=E5=8F=B7=E5=8C=96?= =?UTF-8?q?=E3=82=B3=E3=83=9E=E3=83=B3=E3=83=89=E3=82=92=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QRCode/サービス券復号化.php | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 app/Console/Commands/QRCode/サービス券復号化.php diff --git a/app/Console/Commands/QRCode/サービス券復号化.php b/app/Console/Commands/QRCode/サービス券復号化.php new file mode 100644 index 0000000..da5f6ac --- /dev/null +++ b/app/Console/Commands/QRCode/サービス券復号化.php @@ -0,0 +1,79 @@ +argument("input"); + if (!$input) { + $this->outputError("入力エラー"); + return self::RESULTCODE_FAILED; + } + + $origin = Str::substr($input, 5); + + $result = QRCryptoLogic::decrypt($origin); + $this->outputInfo(sprintf("復号化:[%s]->[%s]", $origin, $result)); + + $this->qrParse($result); + + return self::RESULTCODE_SUCCESS; + } + + private function qrParse(string $input) + { + $発行端末 = Str::substr($input, 0, 2); + $発行日 = Str::substr($input, 2, 8); + $発行連番 = Str::substr($input, 10, 6); + $店舗番号 = Str::substr($input, 16, 2); + $券コード = Str::substr($input, 18, 2); + + $this->outputInfo(sprintf("発行端末[%s] 発行日[%s] 発行連番[%s] 店舗番号[%s] 券コード[%s]", $発行端末, $発行日, $発行連番, $店舗番号, $券コード)); + } +}