travel/service/app/command/Test.php

41 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2024-11-25 17:18:00 +08:00
<?php
namespace app\command;
use app\api\controller\DyNotifyController;
use app\server\DyApiService;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class Test extends Command
{
protected static $defaultName = 'test';
protected static $defaultDescription = '测试用';
/**
* @return void
*/
protected function configure()
{
// $this->addArgument('name', InputArgument::OPTIONAL, 'Name description');
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$encryptStr = (new DyApiService())->encrypt('这是一个测试', env('DY_APPSECRET'));
$output->write('加密字符串:' . $encryptStr);
$decryptStr = (new DyApiService())->decrypt($encryptStr, env('DY_APPSECRET'));
$output->write('解密字符串:' . $decryptStr);
return 0;
}
}