From df3533f3af1dd3602215a889f3cbe5e7b5ddfd6b Mon Sep 17 00:00:00 2001 From: George Xie Date: Sat, 23 Jun 2018 11:22:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=9F=E9=9A=8F=20php-internal-api-client=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- composer.lock | 10 +++++----- src/functions.php | 33 ++++++++++++--------------------- tests/text.php | 6 +++++- 4 files changed, 23 insertions(+), 28 deletions(-) diff --git a/composer.json b/composer.json index 2f4316a..63c7e49 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ ] }, "require": { - "arch/php-internal-api-client": "^0.6.0" + "arch/php-internal-api-client": "^0.6.1" }, "repositories": { "php-internal-api-client": { diff --git a/composer.lock b/composer.lock index 64dd26d..7988657 100644 --- a/composer.lock +++ b/composer.lock @@ -1,18 +1,18 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9120ce1877a91e8f61b9c5e08f2b73b3", + "content-hash": "cb24f2da898fb06d105ad5e3b37c9ae5", "packages": [ { "name": "arch/php-internal-api-client", - "version": "v0.6", + "version": "v0.6.1", "source": { "type": "git", "url": "git@git.int.haowumc.com:arch/php-internal-api-client.git", - "reference": "5aaeaa04998ee522133ad9880cee91fa10d47801" + "reference": "6c54737d1300c1b4160de3bc476a16a76e450190" }, "require": { "guzzlehttp/guzzle": "^6.3", @@ -27,7 +27,7 @@ "src/helpers.php" ] }, - "time": "2018-03-19T09:01:14+00:00" + "time": "2018-06-22T12:21:08+00:00" }, { "name": "doctrine/inflector", diff --git a/src/functions.php b/src/functions.php index 1b26e08..a283090 100644 --- a/src/functions.php +++ b/src/functions.php @@ -1,22 +1,21 @@ 'http://crm.in.haowumc.com/api/wechat/', + 'appid' => 'notification', + 'secret' => '123456', +]); + + + /** * 对企业微信群发送报警信息(需先创建 * @param $chat * @param $text * @return mixed|null */ -function chat_text_alert($chat, $text) -{ - $config = [ - 'crm' => [ - 'base_uri' => 'http://crm.in.haowumc.com/api/wechat/', - 'appid' => 'notification', - 'secret' => '123456', - ], - ]; - - $client = (new \PdInternalApi\Client($config))->app('crm'); +function chat_text_alert($chat, $text){ + $client = new \PdInternalApi\Client('crm', CRM_API_CONFIG); try { $resp = $client->call('work/text', [ @@ -38,15 +37,7 @@ function chat_text_alert($chat, $text) * @return mixed|null */ function user_text_alert($username, $text){ - $config = [ - 'crm' => [ - 'base_uri' => 'http://crm.in.haowumc.com/api/wechat/', - 'appid' => 'notification', - 'secret' => '123456', - ], - ]; - - $client = (new \PdInternalApi\Client($config))->app('crm'); + $client = new \PdInternalApi\Client('crm', CRM_API_CONFIG); try { $resp = $client->call('work/text', [ @@ -59,4 +50,4 @@ function user_text_alert($username, $text){ } return $resp; -} \ No newline at end of file +} diff --git a/tests/text.php b/tests/text.php index 65cc818..028c173 100644 --- a/tests/text.php +++ b/tests/text.php @@ -1,8 +1,12 @@