|
|
|
@@ -0,0 +1,63 @@ |
|
|
|
<?php |
|
|
|
|
|
|
|
namespace App\Console\Commands\QRCode; |
|
|
|
|
|
|
|
use App\Console\Commands\BaseCommand; |
|
|
|
use App\Logics\QRService\QRCryptoLogic; |
|
|
|
|
|
|
|
class サービス券暗号化 extends BaseCommand |
|
|
|
{ |
|
|
|
|
|
|
|
const COMMAND = "qrcode:encrypto {input}"; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* The name and signature of the console command. |
|
|
|
* |
|
|
|
* @var string |
|
|
|
*/ |
|
|
|
protected $signature = self::COMMAND; |
|
|
|
|
|
|
|
/** |
|
|
|
* The console command description. |
|
|
|
* |
|
|
|
* @var string |
|
|
|
*/ |
|
|
|
protected $description = 'QRサービス券を暗号化する。'; |
|
|
|
|
|
|
|
static public function getCommand() |
|
|
|
{ |
|
|
|
return self::COMMAND; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Create a new command instance. |
|
|
|
* |
|
|
|
* @return void |
|
|
|
*/ |
|
|
|
public function __construct() |
|
|
|
{ |
|
|
|
parent::__construct(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Execute the console command. |
|
|
|
* |
|
|
|
* @return int |
|
|
|
*/ |
|
|
|
public function service(): int |
|
|
|
{ |
|
|
|
$input = $this->argument("input"); |
|
|
|
if (!$input) { |
|
|
|
$this->outputError("入力エラー"); |
|
|
|
return self::RESULTCODE_FAILED; |
|
|
|
} |
|
|
|
|
|
|
|
$result = QRCryptoLogic::encrypt($input); |
|
|
|
$this->outputInfo(sprintf("暗号化:[%s]->[%s]", $input, $result)); |
|
|
|
|
|
|
|
return self::RESULTCODE_SUCCESS; |
|
|
|
} |
|
|
|
} |