From ff69dacdb2fa401873b9b1143d6666912f7effc9 Mon Sep 17 00:00:00 2001 From: lisida <506400117@qq.com> Date: Tue, 26 Feb 2019 13:11:55 +0800 Subject: [PATCH] composer update --- composer.json | 5 ----- composer.lock | 25 +--------------------- src/functions.php | 54 ++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 45 insertions(+), 39 deletions(-) diff --git a/composer.json b/composer.json index 245da29..a7ecb6a 100644 --- a/composer.json +++ b/composer.json @@ -12,14 +12,9 @@ ] }, "require": { - "arch/php-internal-api-client": "^0.6.1", "paidian/json-rpc": "~1.1" }, "repositories": { - "php-internal-api-client": { - "type": "vcs", - "url": "git@git.int.haowumc.com:arch/php-internal-api-client.git" - }, "php-json-rpc": { "type": "vcs", "url": "git@git.int.haowumc.com:composer/php-json-rpc.git" diff --git a/composer.lock b/composer.lock index 8182829..91239a4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,31 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "da7df43f2cca475d53124412fd3fdfcb", + "content-hash": "ff9203293e7978ba588135c0b81d5960", "packages": [ - { - "name": "arch/php-internal-api-client", - "version": "v0.6.2", - "source": { - "type": "git", - "url": "git@git.int.haowumc.com:arch/php-internal-api-client.git", - "reference": "436a0845815e3df2e6a8b41f28958aebc2b66fd0" - }, - "require": { - "guzzlehttp/guzzle": "^6.3", - "illuminate/http": "^5.5" - }, - "type": "library", - "autoload": { - "psr-4": { - "PdInternalApi\\": "src/" - }, - "files": [ - "src/helpers.php" - ] - }, - "time": "2018-06-26T02:50:49+00:00" - }, { "name": "doctrine/inflector", "version": "v1.3.0", diff --git a/src/functions.php b/src/functions.php index 0998d64..debb912 100644 --- a/src/functions.php +++ b/src/functions.php @@ -1,6 +1,6 @@ env('APP_NAME'), 'client' => [ 'auth' => [ @@ -11,13 +11,18 @@ define('RPC_CONFIG',[ /** * 对企业微信群发送报警信息(需先创建 + * * @param $chat * @param $text + * * @return mixed|null */ -function chat_text_alert($chat, $text) +function chat_text_alert ($chat, $text) { + if (env('APP_ENV') == 'local') { + return true; + } $base_client = new \JsonRpc\Client(RPC_CONFIG); $client = $base_client->endpoint('auth'); @@ -36,15 +41,20 @@ function chat_text_alert($chat, $text) /** * 对单个或多个用户发送报警或通知信息,多个用户id使用 | 隔开 + * * @param $text + * * @return mixed|null */ -function user_text_alert($username, $text) +function user_text_alert ($username, $text) { + if (env('APP_ENV') == 'local') { + return true; + } $base_client = new \JsonRpc\Client(RPC_CONFIG); $client = $base_client->endpoint('auth'); - $username = explode('|',$username); + $username = explode('|', $username); try { $res = $client->call('notify.text', [ ['user' => $username], @@ -60,15 +70,21 @@ function user_text_alert($username, $text) /** * 对微信群发送文本卡片 + * * @param $chat * @param $title * @param $desc * @param $button * @param $url + * * @return mixed|null */ -function chat_card_alert($chat, $title, $desc, $button, $url) +function chat_card_alert ($chat, $title, $desc, $button, $url) { + if (env('APP_ENV') == 'local') { + return true; + } + $base_client = new \JsonRpc\Client(RPC_CONFIG); $client = $base_client->endpoint('auth'); @@ -90,19 +106,25 @@ function chat_card_alert($chat, $title, $desc, $button, $url) /** * 对单个或多个用户发送文本卡片,多个用户id使用 | 隔开 + * * @param $username * @param $title * @param $desc * @param $button * @param $url + * * @return mixed|null */ -function user_card_alert($username, $title, $desc, $button, $url) +function user_card_alert ($username, $title, $desc, $button, $url) { + if (env('APP_ENV') == 'local') { + return true; + } + $base_client = new \JsonRpc\Client(RPC_CONFIG); $client = $base_client->endpoint('auth'); - $username = explode('|',$username); + $username = explode('|', $username); try { $resp = $client->call('notify.card', [ ['user' => $username], @@ -121,6 +143,7 @@ function user_card_alert($username, $title, $desc, $button, $url) /** * 对单个或多个用户发送文本卡片,多个用户id使用 | 隔开 + * * @param $username * @param $appid //小程序的appid * @param $title //标题 @@ -128,14 +151,19 @@ function user_card_alert($username, $title, $desc, $button, $url) * @param $desc //描述 * @param $items //消息内容键值对,最多允许10个item * @param $emphasisFirstItem //是否放大第一个content_item + * * @return mixed|null */ -function user_mp_alert($username, $appid, $title, $page = null, $desc = null,$items = null,$emphasisFirstItem = null) +function user_mp_alert ($username, $appid, $title, $page = null, $desc = null, $items = null, $emphasisFirstItem = null) { + if (env('APP_ENV') == 'local') { + return true; + } + $base_client = new \JsonRpc\Client(RPC_CONFIG); $client = $base_client->endpoint('auth'); - $username = explode('|',$username); + $username = explode('|', $username); try { $resp = $client->call('notify.mp', [ ['user' => $username], @@ -156,6 +184,7 @@ function user_mp_alert($username, $appid, $title, $page = null, $desc = null,$it /** * 对单个或多个用户发送文本卡片,多个用户id使用 | 隔开 + * * @param $username * @param $appid //小程序的appid * @param $title //标题 @@ -163,10 +192,15 @@ function user_mp_alert($username, $appid, $title, $page = null, $desc = null,$it * @param $desc //描述 * @param $items //消息内容键值对,最多允许10个item * @param $emphasisFirstItem //是否放大第一个content_item + * * @return mixed|null */ -function tag_mp_alert($tag, $appid, $title, $page = null, $desc = null,$items = null,$emphasisFirstItem = null) +function tag_mp_alert ($tag, $appid, $title, $page = null, $desc = null, $items = null, $emphasisFirstItem = null) { + if (env('APP_ENV') == 'local') { + return true; + } + $base_client = new \JsonRpc\Client(RPC_CONFIG); $client = $base_client->endpoint('auth');