From b43ae9c130e5468924badd0169e2c33be6de741f Mon Sep 17 00:00:00 2001 From: "sosuke.iwabuchi" Date: Fri, 29 Mar 2024 21:54:32 +0900 Subject: [PATCH] =?UTF-8?q?=E8=AA=8D=E8=A8=BC=E7=94=A8QR=E8=AA=AD=E3=81=BF?= =?UTF-8?q?=E8=BE=BC=E3=81=BF=E5=87=A6=E7=90=86=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CheckDataFormatController.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/Http/Controllers/Web/QRService/Certification/CheckDataFormatController.php b/app/Http/Controllers/Web/QRService/Certification/CheckDataFormatController.php index f5b4a13..138039e 100644 --- a/app/Http/Controllers/Web/QRService/Certification/CheckDataFormatController.php +++ b/app/Http/Controllers/Web/QRService/Certification/CheckDataFormatController.php @@ -120,17 +120,17 @@ class DataConverter { $ret = new static(); - $dec = QRCryptoLogic::decrypt($data); - if (strlen($dec) !== 30) { - throw new GeneralErrorMessageException("文字数不正"); - } - $data = substr($dec, 5); + $target = substr($data, 5); - $ret->発行端末 = substr($data, 0, 2); - $ret->発行日 = Carbon::createFromFormat("Ymd", substr($data, 2, 8)); - $ret->発行連番 = intval(substr($data, 10, 6)); - $ret->顧客コード = substr($data, 16, 4); - $ret->駐車場管理コード = substr($data, 20, 5); + $dec = QRCryptoLogic::decrypt($target); + if (strlen($dec) !== 15) { + throw new GeneralErrorMessageException("URL不正"); + } + $ret->発行端末 = substr($dec, 0, 2); + $ret->発行日 = Carbon::createFromFormat("Ymd", substr($dec, 2, 8)); + $ret->発行連番 = intval(substr($dec, 10, 6)); + $ret->顧客コード = substr($dec, 16, 4); + $ret->駐車場管理コード = substr($dec, 20, 5); return $ret;