跟随 php-internal-api-client 修改
This commit is contained in:
parent
8e907e99a1
commit
df3533f3af
|
@ -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": {
|
||||
|
|
10
composer.lock
generated
10
composer.lock
generated
|
@ -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",
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
<?php
|
||||
|
||||
define('CRM_API_CONFIG', [
|
||||
'base_uri' => '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', [
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 'stderr');
|
||||
|
||||
require_once dirname(__DIR__).'/vendor/autoload.php';
|
||||
|
||||
$ret = user_text_alert('houxuejie','dfdfdf');
|
||||
$ret = user_text_alert('xieshi','dfdfdf');
|
||||
var_dump($ret);
|
||||
if( $ret['err_code'] == '0' ){
|
||||
echo "发送成功\n";
|
||||
}else{
|
||||
|
|
Loading…
Reference in New Issue
Block a user