新增command
This commit is contained in:
parent
fa4e3e0382
commit
6f4c729dad
46
app/Command/getProductCommand.php
Normal file
46
app/Command/getProductCommand.php
Normal 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, '签名数据']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -236,8 +236,8 @@ class UserController extends AbstractController
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// 对接处方平台
|
// 对接处方平台
|
||||||
$Prescription = new Prescription();
|
// $Prescription = new Prescription();
|
||||||
$token = $Prescription->getProd();
|
// $token = $Prescription->getProd();
|
||||||
dump($token);
|
// dump($token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -13,13 +13,14 @@
|
|||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=8.0",
|
"php": ">=8.0",
|
||||||
|
"ext-zlib": "*",
|
||||||
"alibabacloud/dysmsapi-20170525": "2.0.23",
|
"alibabacloud/dysmsapi-20170525": "2.0.23",
|
||||||
"aliyuncs/oss-sdk-php": "^2.6",
|
"aliyuncs/oss-sdk-php": "^2.6",
|
||||||
"firebase/php-jwt": "^6.3",
|
"firebase/php-jwt": "^6.3",
|
||||||
"hyperf/amqp": "^3.0",
|
"hyperf/amqp": "^3.0",
|
||||||
"hyperf/async-queue": "~3.0.0",
|
"hyperf/async-queue": "~3.0.0",
|
||||||
"hyperf/cache": "~3.0.0",
|
"hyperf/cache": "~3.0.0",
|
||||||
"hyperf/command": "~3.0.0",
|
"hyperf/command": "^3.0",
|
||||||
"hyperf/config": "~3.0.0",
|
"hyperf/config": "~3.0.0",
|
||||||
"hyperf/constants": "~3.0.0",
|
"hyperf/constants": "~3.0.0",
|
||||||
"hyperf/crontab": "^3.0",
|
"hyperf/crontab": "^3.0",
|
||||||
@ -35,8 +36,7 @@
|
|||||||
"hyperf/redis": "~3.0.0",
|
"hyperf/redis": "~3.0.0",
|
||||||
"hyperf/snowflake": "^3.0",
|
"hyperf/snowflake": "^3.0",
|
||||||
"hyperf/validation": "^3.0",
|
"hyperf/validation": "^3.0",
|
||||||
"w7corp/easywechat": "^6.7",
|
"w7corp/easywechat": "^6.7"
|
||||||
"ext-zlib": "*"
|
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"friendsofphp/php-cs-fixer": "^3.0",
|
"friendsofphp/php-cs-fixer": "^3.0",
|
||||||
|
|||||||
15
composer.lock
generated
15
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "f299641f60e9b66b2129d0c536d32ee8",
|
"content-hash": "dd1e834ab0ebf2d88fbc1edb5950d65f",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "adbario/php-dot-notation",
|
"name": "adbario/php-dot-notation",
|
||||||
@ -1466,16 +1466,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "hyperf/command",
|
"name": "hyperf/command",
|
||||||
"version": "v3.0.0",
|
"version": "v3.0.9",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/hyperf/command.git",
|
"url": "https://github.com/hyperf/command.git",
|
||||||
"reference": "3bb67fd9e776b2987e2b2daf47f55987ad322122"
|
"reference": "7d7d013ffaedfc4805cff9097850b937e95561eb"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://mirrors.huaweicloud.com/repository/php/hyperf/command/v3.0.0/hyperf-command-v3.0.0.zip",
|
"url": "https://mirrors.huaweicloud.com/repository/php/hyperf/command/v3.0.9/hyperf-command-v3.0.9.zip",
|
||||||
"reference": "3bb67fd9e776b2987e2b2daf47f55987ad322122",
|
"reference": "7d7d013ffaedfc4805cff9097850b937e95561eb",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -1507,7 +1507,7 @@
|
|||||||
"php",
|
"php",
|
||||||
"swoole"
|
"swoole"
|
||||||
],
|
],
|
||||||
"time": "2022-11-01T02:50:54+00:00"
|
"time": "2023-03-01T05:30:24+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "hyperf/config",
|
"name": "hyperf/config",
|
||||||
@ -9136,7 +9136,8 @@
|
|||||||
"prefer-stable": true,
|
"prefer-stable": true,
|
||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
"platform": {
|
"platform": {
|
||||||
"php": ">=8.0"
|
"php": ">=8.0",
|
||||||
|
"ext-zlib": "*"
|
||||||
},
|
},
|
||||||
"platform-dev": [],
|
"platform-dev": [],
|
||||||
"plugin-api-version": "2.3.0"
|
"plugin-api-version": "2.3.0"
|
||||||
|
|||||||
@ -36,6 +36,7 @@ class Prescription
|
|||||||
$this->client_id = "ZD-004";
|
$this->client_id = "ZD-004";
|
||||||
$this->client_secret = "0baa5927164710b9f800bf33546b6da3";
|
$this->client_secret = "0baa5927164710b9f800bf33546b6da3";
|
||||||
$this->container = ApplicationContext::getContainer();
|
$this->container = ApplicationContext::getContainer();
|
||||||
|
$this->client = $this->container->get(Client::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -95,6 +96,7 @@ class Prescription
|
|||||||
if (empty($response['result']['rows'])){
|
if (empty($response['result']['rows'])){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
dump($response);
|
dump($response);
|
||||||
// 获取总数
|
// 获取总数
|
||||||
// $count
|
// $count
|
||||||
@ -131,13 +133,11 @@ class Prescription
|
|||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($option)){
|
if (!empty($option)){
|
||||||
$arg = array_merge($arg,$option);
|
$arg = array_merge($arg,$option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dump($arg);
|
|
||||||
|
|
||||||
$response = $this->client->post($path, $arg);
|
$response = $this->client->post($path, $arg);
|
||||||
|
|
||||||
if ($response->getStatusCode() != '200'){
|
if ($response->getStatusCode() != '200'){
|
||||||
@ -150,7 +150,6 @@ class Prescription
|
|||||||
// 返回值为空
|
// 返回值为空
|
||||||
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
|
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
|
||||||
}
|
}
|
||||||
dump($body);
|
|
||||||
|
|
||||||
if (empty($body['data'])){
|
if (empty($body['data'])){
|
||||||
// 返回值为空
|
// 返回值为空
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user