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 e486b73..180f1d2 100644 --- a/src/functions.php +++ b/src/functions.php @@ -1,22 +1,21 @@ 'http://push.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://push.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', [ @@ -37,16 +36,10 @@ function chat_text_alert($chat, $text) * @param $text * @return mixed|null */ -function user_text_alert($username, $text){ - $config = [ - 'crm' => [ - 'base_uri' => 'http://push.in.haowumc.com/api/wechat/', - 'appid' => 'notification', - 'secret' => '123456', - ], - ]; +function user_text_alert($username, $text) +{ - $client = (new \PdInternalApi\Client($config))->app('crm'); + $client = new \PdInternalApi\Client('crm', CRM_API_CONFIG); try { $resp = $client->call('work/text', [ @@ -59,4 +52,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..a7f78bc 100644 --- a/tests/text.php +++ b/tests/text.php @@ -1,8 +1,12 @@