Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
meibuyu-micro
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
without authentication
meibuyu-micro
Commits
ff8b4076
Commit
ff8b4076
authored
Apr 22, 2021
by
王源
🎧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除旧message中心文件
parent
994bd8cc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
103 deletions
+0
-103
message.php
publish/message.php
+0
-12
ConfigProvider.php
src/ConfigProvider.php
+0
-8
MessageCenter.php
src/Message/MessageCenter.php
+0
-83
No files found.
publish/message.php
deleted
100644 → 0
View file @
994bd8cc
<?php
declare
(
strict_types
=
1
);
return
[
'center'
=>
[
'ip'
=>
env
(
'MESSAGE_CENTER_IP'
,
'127.0.0.1'
),
'domain'
=>
env
(
'MESSAGE_CENTER_DOMAIN'
,
'http://localhost'
),
'proxy'
=>
env
(
'MESSAGE_CENTER_PROXY'
),
'proxy_port'
=>
env
(
'MESSAGE_CENTER_PROXY_PORT'
,
80
),
]
];
src/ConfigProvider.php
View file @
ff8b4076
...
@@ -39,14 +39,6 @@ class ConfigProvider
...
@@ -39,14 +39,6 @@ class ConfigProvider
],
],
],
],
],
],
'publish'
=>
[
[
'id'
=>
'message'
,
'description'
=>
'message'
,
'source'
=>
__DIR__
.
'/../publish/message.php'
,
'destination'
=>
BASE_PATH
.
'/config/autoload/message.php'
,
],
],
];
];
}
}
}
}
src/Message/MessageCenter.php
deleted
100644 → 0
View file @
994bd8cc
<?php
/**
* Created by PhpStorm.
* User: Zero
* Date: 2020/4/15
* Time: 9:19
*/
namespace
Meibuyu\Micro\Message
;
use
GuzzleHttp\Client
;
use
GuzzleHttp\HandlerStack
;
use
Hyperf\Contract\ConfigInterface
;
use
Hyperf\Guzzle\CoroutineHandler
;
use
Hyperf\Guzzle\HandlerStackFactory
;
class
MessageCenter
{
/**
* @var Client
*/
protected
$client
;
/**
* @var ConfigInterface
*/
private
$config
;
/**
* @var HandlerStackFactory
*/
protected
$stackFactory
;
public
function
__construct
(
ConfigInterface
$config
,
HandlerStackFactory
$stackFactory
)
{
$this
->
config
=
$config
;
$this
->
stackFactory
=
$stackFactory
;
$this
->
initClient
();
}
public
function
initClient
()
{
$options
=
[
'base_uri'
=>
$this
->
config
->
get
(
'message.center.domain'
)
.
'/api/'
,
'handler'
=>
HandlerStack
::
create
(
new
CoroutineHandler
()),
'timeout'
=>
60
,
];
$proxy
=
$this
->
config
->
get
(
'message.center.proxy'
);
if
(
$proxy
)
{
$options
=
array_merge
(
$options
,
[
'proxy'
=>
$proxy
,
'swoole'
=>
[
'http_proxy_port'
=>
$this
->
config
->
get
(
'message.center.proxy_port'
),
]
]);
}
$this
->
client
=
make
(
Client
::
class
,
[
'config'
=>
$options
]);
}
public
function
request
(
$type
,
$uri
,
$data
=
[])
{
return
$this
->
client
->
request
(
$type
,
$uri
,
[
'body'
=>
json_encode
(
$data
),
'headers'
=>
[
'content-type'
=>
'application/json'
]
]);
}
public
function
syncDingUser
()
{
$response
=
$this
->
client
->
request
(
'GET'
,
'synchronizationDingUser'
);
return
json_decode
(
$response
->
getBody
()
->
getContents
(),
true
);
}
public
function
sendDing
(
$userId
,
$message
)
{
$response
=
$this
->
client
->
request
(
'POST'
,
'sendDing'
,
[
'body'
=>
json_encode
([
'userId'
=>
$userId
,
'message'
=>
$message
]),
'headers'
=>
[
'content-type'
=>
'application/json'
]
]);
return
json_decode
(
$response
->
getBody
()
->
getContents
(),
true
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment