新增command

This commit is contained in:
2023-03-14 19:46:45 +08:00
parent fa4e3e0382
commit 6f4c729dad
5 changed files with 63 additions and 17 deletions
+46
View File
@@ -0,0 +1,46 @@
<?php
declare(strict_types=1);
namespace App\Command;
use Hyperf\Command\Command as HyperfCommand;
use Hyperf\Command\Annotation\Command;
use Psr\Container\ContainerInterface;
use Symfony\Component\Console\Input\InputArgument;
/**
* 更新处方平台商品
*/
#[Command]
class getProductCommand extends HyperfCommand
{
public function __construct(protected ContainerInterface $container)
{
parent::__construct('getProduct:command');
}
public function configure()
{
parent::configure();
$this->setDescription('获取处方平台商品数据');
}
// 主逻辑处理
public function handle()
{
$sign = $this->input->getArgument('sign');
$this->line($sign);
}
/**
* 参数设置
* @return array[]
*/
protected function getArguments(): array
{
return [
['sign', InputArgument::REQUIRED, '签名数据']
];
}
}
+3 -3
View File
@@ -236,8 +236,8 @@ class UserController extends AbstractController
// }
// 对接处方平台
$Prescription = new Prescription();
$token = $Prescription->getProd();
dump($token);
// $Prescription = new Prescription();
// $token = $Prescription->getProd();
// dump($token);
}
}