From 6f4c729dad3271c1ee7ebac5d159dccb344b34fb Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 14 Mar 2023 19:46:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Ecommand?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Command/getProductCommand.php | 46 ++++++++++++++++++++++++++++ app/Controller/UserController.php | 6 ++-- composer.json | 6 ++-- composer.lock | 15 ++++----- extend/Prescription/Prescription.php | 7 ++--- 5 files changed, 63 insertions(+), 17 deletions(-) create mode 100644 app/Command/getProductCommand.php diff --git a/app/Command/getProductCommand.php b/app/Command/getProductCommand.php new file mode 100644 index 0000000..1f99e0c --- /dev/null +++ b/app/Command/getProductCommand.php @@ -0,0 +1,46 @@ +setDescription('获取处方平台商品数据'); + } + + // 主逻辑处理 + public function handle() + { + $sign = $this->input->getArgument('sign'); + $this->line($sign); + } + + /** + * 参数设置 + * @return array[] + */ + protected function getArguments(): array + { + return [ + ['sign', InputArgument::REQUIRED, '签名数据'] + ]; + } +} diff --git a/app/Controller/UserController.php b/app/Controller/UserController.php index 08c147f..6f3047f 100644 --- a/app/Controller/UserController.php +++ b/app/Controller/UserController.php @@ -236,8 +236,8 @@ class UserController extends AbstractController // } // 对接处方平台 - $Prescription = new Prescription(); - $token = $Prescription->getProd(); - dump($token); +// $Prescription = new Prescription(); +// $token = $Prescription->getProd(); +// dump($token); } } \ No newline at end of file diff --git a/composer.json b/composer.json index cfa2ced..506e03e 100644 --- a/composer.json +++ b/composer.json @@ -13,13 +13,14 @@ "license": "Apache-2.0", "require": { "php": ">=8.0", + "ext-zlib": "*", "alibabacloud/dysmsapi-20170525": "2.0.23", "aliyuncs/oss-sdk-php": "^2.6", "firebase/php-jwt": "^6.3", "hyperf/amqp": "^3.0", "hyperf/async-queue": "~3.0.0", "hyperf/cache": "~3.0.0", - "hyperf/command": "~3.0.0", + "hyperf/command": "^3.0", "hyperf/config": "~3.0.0", "hyperf/constants": "~3.0.0", "hyperf/crontab": "^3.0", @@ -35,8 +36,7 @@ "hyperf/redis": "~3.0.0", "hyperf/snowflake": "^3.0", "hyperf/validation": "^3.0", - "w7corp/easywechat": "^6.7", - "ext-zlib": "*" + "w7corp/easywechat": "^6.7" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.0", diff --git a/composer.lock b/composer.lock index 0991eb6..7d2d3f3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f299641f60e9b66b2129d0c536d32ee8", + "content-hash": "dd1e834ab0ebf2d88fbc1edb5950d65f", "packages": [ { "name": "adbario/php-dot-notation", @@ -1466,16 +1466,16 @@ }, { "name": "hyperf/command", - "version": "v3.0.0", + "version": "v3.0.9", "source": { "type": "git", "url": "https://github.com/hyperf/command.git", - "reference": "3bb67fd9e776b2987e2b2daf47f55987ad322122" + "reference": "7d7d013ffaedfc4805cff9097850b937e95561eb" }, "dist": { "type": "zip", - "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/command/v3.0.0/hyperf-command-v3.0.0.zip", - "reference": "3bb67fd9e776b2987e2b2daf47f55987ad322122", + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/command/v3.0.9/hyperf-command-v3.0.9.zip", + "reference": "7d7d013ffaedfc4805cff9097850b937e95561eb", "shasum": "" }, "require": { @@ -1507,7 +1507,7 @@ "php", "swoole" ], - "time": "2022-11-01T02:50:54+00:00" + "time": "2023-03-01T05:30:24+00:00" }, { "name": "hyperf/config", @@ -9136,7 +9136,8 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": ">=8.0" + "php": ">=8.0", + "ext-zlib": "*" }, "platform-dev": [], "plugin-api-version": "2.3.0" diff --git a/extend/Prescription/Prescription.php b/extend/Prescription/Prescription.php index 13a0013..c26bb02 100644 --- a/extend/Prescription/Prescription.php +++ b/extend/Prescription/Prescription.php @@ -36,6 +36,7 @@ class Prescription $this->client_id = "ZD-004"; $this->client_secret = "0baa5927164710b9f800bf33546b6da3"; $this->container = ApplicationContext::getContainer(); + $this->client = $this->container->get(Client::class); } /** @@ -95,6 +96,7 @@ class Prescription if (empty($response['result']['rows'])){ return true; } + dump($response); // 获取总数 // $count @@ -131,13 +133,11 @@ class Prescription ] ]; } + if (!empty($option)){ $arg = array_merge($arg,$option); } - - dump($arg); - $response = $this->client->post($path, $arg); if ($response->getStatusCode() != '200'){ @@ -150,7 +150,6 @@ class Prescription // 返回值为空 throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR)); } - dump($body); if (empty($body['data'])){ // 返回值为空