Merge branch 'feature/rpc' into 'master'
composer update See merge request composer/php-alert-client!1
This commit is contained in:
commit
3b8ec334de
|
@ -12,14 +12,9 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"arch/php-internal-api-client": "^0.6.1",
|
|
||||||
"paidian/json-rpc": "~1.1"
|
"paidian/json-rpc": "~1.1"
|
||||||
},
|
},
|
||||||
"repositories": {
|
"repositories": {
|
||||||
"php-internal-api-client": {
|
|
||||||
"type": "vcs",
|
|
||||||
"url": "git@git.int.haowumc.com:arch/php-internal-api-client.git"
|
|
||||||
},
|
|
||||||
"php-json-rpc": {
|
"php-json-rpc": {
|
||||||
"type": "vcs",
|
"type": "vcs",
|
||||||
"url": "git@git.int.haowumc.com:composer/php-json-rpc.git"
|
"url": "git@git.int.haowumc.com:composer/php-json-rpc.git"
|
||||||
|
|
25
composer.lock
generated
25
composer.lock
generated
|
@ -4,31 +4,8 @@
|
||||||
"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#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "da7df43f2cca475d53124412fd3fdfcb",
|
"content-hash": "ff9203293e7978ba588135c0b81d5960",
|
||||||
"packages": [
|
"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",
|
"name": "doctrine/inflector",
|
||||||
"version": "v1.3.0",
|
"version": "v1.3.0",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('RPC_CONFIG',[
|
define('RPC_CONFIG', [
|
||||||
'app' => env('APP_NAME'),
|
'app' => env('APP_NAME'),
|
||||||
'client' => [
|
'client' => [
|
||||||
'auth' => [
|
'auth' => [
|
||||||
|
@ -11,13 +11,18 @@ define('RPC_CONFIG',[
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对企业微信群发送报警信息(需先创建
|
* 对企业微信群发送报警信息(需先创建
|
||||||
|
*
|
||||||
* @param $chat
|
* @param $chat
|
||||||
* @param $text
|
* @param $text
|
||||||
|
*
|
||||||
* @return mixed|null
|
* @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);
|
$base_client = new \JsonRpc\Client(RPC_CONFIG);
|
||||||
$client = $base_client->endpoint('auth');
|
$client = $base_client->endpoint('auth');
|
||||||
|
|
||||||
|
@ -36,15 +41,20 @@ function chat_text_alert($chat, $text)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对单个或多个用户发送报警或通知信息,多个用户id使用 | 隔开
|
* 对单个或多个用户发送报警或通知信息,多个用户id使用 | 隔开
|
||||||
|
*
|
||||||
* @param $text
|
* @param $text
|
||||||
|
*
|
||||||
* @return mixed|null
|
* @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);
|
$base_client = new \JsonRpc\Client(RPC_CONFIG);
|
||||||
$client = $base_client->endpoint('auth');
|
$client = $base_client->endpoint('auth');
|
||||||
|
|
||||||
$username = explode('|',$username);
|
$username = explode('|', $username);
|
||||||
try {
|
try {
|
||||||
$res = $client->call('notify.text', [
|
$res = $client->call('notify.text', [
|
||||||
['user' => $username],
|
['user' => $username],
|
||||||
|
@ -60,15 +70,21 @@ function user_text_alert($username, $text)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对微信群发送文本卡片
|
* 对微信群发送文本卡片
|
||||||
|
*
|
||||||
* @param $chat
|
* @param $chat
|
||||||
* @param $title
|
* @param $title
|
||||||
* @param $desc
|
* @param $desc
|
||||||
* @param $button
|
* @param $button
|
||||||
* @param $url
|
* @param $url
|
||||||
|
*
|
||||||
* @return mixed|null
|
* @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);
|
$base_client = new \JsonRpc\Client(RPC_CONFIG);
|
||||||
$client = $base_client->endpoint('auth');
|
$client = $base_client->endpoint('auth');
|
||||||
|
|
||||||
|
@ -90,19 +106,25 @@ function chat_card_alert($chat, $title, $desc, $button, $url)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对单个或多个用户发送文本卡片,多个用户id使用 | 隔开
|
* 对单个或多个用户发送文本卡片,多个用户id使用 | 隔开
|
||||||
|
*
|
||||||
* @param $username
|
* @param $username
|
||||||
* @param $title
|
* @param $title
|
||||||
* @param $desc
|
* @param $desc
|
||||||
* @param $button
|
* @param $button
|
||||||
* @param $url
|
* @param $url
|
||||||
|
*
|
||||||
* @return mixed|null
|
* @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);
|
$base_client = new \JsonRpc\Client(RPC_CONFIG);
|
||||||
$client = $base_client->endpoint('auth');
|
$client = $base_client->endpoint('auth');
|
||||||
|
|
||||||
$username = explode('|',$username);
|
$username = explode('|', $username);
|
||||||
try {
|
try {
|
||||||
$resp = $client->call('notify.card', [
|
$resp = $client->call('notify.card', [
|
||||||
['user' => $username],
|
['user' => $username],
|
||||||
|
@ -121,6 +143,7 @@ function user_card_alert($username, $title, $desc, $button, $url)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对单个或多个用户发送文本卡片,多个用户id使用 | 隔开
|
* 对单个或多个用户发送文本卡片,多个用户id使用 | 隔开
|
||||||
|
*
|
||||||
* @param $username
|
* @param $username
|
||||||
* @param $appid //小程序的appid
|
* @param $appid //小程序的appid
|
||||||
* @param $title //标题
|
* @param $title //标题
|
||||||
|
@ -128,14 +151,19 @@ function user_card_alert($username, $title, $desc, $button, $url)
|
||||||
* @param $desc //描述
|
* @param $desc //描述
|
||||||
* @param $items //消息内容键值对,最多允许10个item
|
* @param $items //消息内容键值对,最多允许10个item
|
||||||
* @param $emphasisFirstItem //是否放大第一个content_item
|
* @param $emphasisFirstItem //是否放大第一个content_item
|
||||||
|
*
|
||||||
* @return mixed|null
|
* @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);
|
$base_client = new \JsonRpc\Client(RPC_CONFIG);
|
||||||
$client = $base_client->endpoint('auth');
|
$client = $base_client->endpoint('auth');
|
||||||
|
|
||||||
$username = explode('|',$username);
|
$username = explode('|', $username);
|
||||||
try {
|
try {
|
||||||
$resp = $client->call('notify.mp', [
|
$resp = $client->call('notify.mp', [
|
||||||
['user' => $username],
|
['user' => $username],
|
||||||
|
@ -156,6 +184,7 @@ function user_mp_alert($username, $appid, $title, $page = null, $desc = null,$it
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对单个或多个用户发送文本卡片,多个用户id使用 | 隔开
|
* 对单个或多个用户发送文本卡片,多个用户id使用 | 隔开
|
||||||
|
*
|
||||||
* @param $username
|
* @param $username
|
||||||
* @param $appid //小程序的appid
|
* @param $appid //小程序的appid
|
||||||
* @param $title //标题
|
* @param $title //标题
|
||||||
|
@ -163,10 +192,15 @@ function user_mp_alert($username, $appid, $title, $page = null, $desc = null,$it
|
||||||
* @param $desc //描述
|
* @param $desc //描述
|
||||||
* @param $items //消息内容键值对,最多允许10个item
|
* @param $items //消息内容键值对,最多允许10个item
|
||||||
* @param $emphasisFirstItem //是否放大第一个content_item
|
* @param $emphasisFirstItem //是否放大第一个content_item
|
||||||
|
*
|
||||||
* @return mixed|null
|
* @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);
|
$base_client = new \JsonRpc\Client(RPC_CONFIG);
|
||||||
$client = $base_client->endpoint('auth');
|
$client = $base_client->endpoint('auth');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user