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]", $発行端末, $発行日, $発行連番, $店舗番号, $券コード)); + } +}