@@ -36,7 +36,7 @@ |
||
36 | 36 | */ |
37 | 37 | protected function registerLaravelBindings() |
38 | 38 | { |
39 | - $this->app->singleton(DingTalk::class, function ($app) { |
|
39 | + $this->app->singleton(DingTalk::class, function($app) { |
|
40 | 40 | return new DingTalk($app['config']['ding']); |
41 | 41 | }); |
42 | 42 | } |
@@ -2,12 +2,12 @@ |
||
2 | 2 | |
3 | 3 | use DingNotice\DingTalk; |
4 | 4 | |
5 | -if (!function_exists('ding')){ |
|
5 | +if (!function_exists('ding')) { |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * @return bool|DingTalk |
9 | 9 | */ |
10 | - function ding(){ |
|
10 | + function ding() { |
|
11 | 11 | |
12 | 12 | $arguments = func_get_args(); |
13 | 13 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | } |
17 | 17 | |
18 | - public function setMessage(){ |
|
18 | + public function setMessage() { |
|
19 | 19 | $this->message = [ |
20 | 20 | 'feedCard' => [ |
21 | 21 | 'links' => [] |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | ]; |
25 | 25 | } |
26 | 26 | |
27 | - public function addLinks($title,$messageUrl,$picUrl){ |
|
27 | + public function addLinks($title, $messageUrl, $picUrl) { |
|
28 | 28 | $this->message['feedCard']['links'][] = [ |
29 | 29 | 'title' => $title, |
30 | 30 | 'messageURL' => $messageUrl, |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | return $this; |
34 | 34 | } |
35 | 35 | |
36 | - public function send(){ |
|
36 | + public function send() { |
|
37 | 37 | $this->service->setMessage($this); |
38 | 38 | return $this->service->send(); |
39 | 39 | } |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | |
10 | 10 | protected $service; |
11 | 11 | |
12 | - public function __construct(DingTalkService $service,$title, $markdown, $hideAvatar = 0, $btnOrientation = 0) |
|
12 | + public function __construct(DingTalkService $service, $title, $markdown, $hideAvatar = 0, $btnOrientation = 0) |
|
13 | 13 | { |
14 | 14 | $this->service = $service; |
15 | - $this->setMessage($title,$markdown,$hideAvatar,$btnOrientation); |
|
15 | + $this->setMessage($title, $markdown, $hideAvatar, $btnOrientation); |
|
16 | 16 | } |
17 | 17 | |
18 | - public function setMessage($title, $markdown, $hideAvatar = 0, $btnOrientation = 0){ |
|
18 | + public function setMessage($title, $markdown, $hideAvatar = 0, $btnOrientation = 0) { |
|
19 | 19 | $this->message = [ |
20 | 20 | 'msgtype' => 'actionCard', |
21 | 21 | 'actionCard' => [ |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | ]; |
28 | 28 | } |
29 | 29 | |
30 | - public function single($title,$url){ |
|
30 | + public function single($title, $url) { |
|
31 | 31 | $this->message['actionCard']['singleTitle'] = $title; |
32 | 32 | $this->message['actionCard']['singleURL'] = $url; |
33 | 33 | $this->service->setMessage($this); |
34 | 34 | return $this; |
35 | 35 | } |
36 | 36 | |
37 | - public function addButtons($title,$url){ |
|
37 | + public function addButtons($title, $url) { |
|
38 | 38 | $this->message['actionCard']['btns'][] = [ |
39 | 39 | 'title' => $title, |
40 | 40 | 'actionURL' => $url |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | return $this; |
43 | 43 | } |
44 | 44 | |
45 | - public function send(){ |
|
45 | + public function send() { |
|
46 | 46 | $this->service->setMessage($this); |
47 | 47 | return $this->service->send(); |
48 | 48 | } |
@@ -5,13 +5,13 @@ |
||
5 | 5 | class Link extends Message |
6 | 6 | { |
7 | 7 | |
8 | - public function __construct($title,$text,$messageUrl,$picUrl = '') |
|
8 | + public function __construct($title, $text, $messageUrl, $picUrl = '') |
|
9 | 9 | { |
10 | - $this->setMessage($title,$text,$messageUrl,$picUrl); |
|
10 | + $this->setMessage($title, $text, $messageUrl, $picUrl); |
|
11 | 11 | } |
12 | 12 | |
13 | - public function setMessage($title,$text,$messageUrl,$picUrl = ''){ |
|
14 | - $this->message = [ |
|
13 | + public function setMessage($title, $text, $messageUrl, $picUrl = '') { |
|
14 | + $this->message = [ |
|
15 | 15 | 'msgtype' => 'link', |
16 | 16 | 'link' => [ |
17 | 17 | 'text' => $text, |
@@ -4,13 +4,13 @@ |
||
4 | 4 | |
5 | 5 | class Markdown extends Message |
6 | 6 | { |
7 | - public function __construct($title,$markdown) |
|
7 | + public function __construct($title, $markdown) |
|
8 | 8 | { |
9 | - $this->setMessage($title,$markdown); |
|
9 | + $this->setMessage($title, $markdown); |
|
10 | 10 | } |
11 | 11 | |
12 | - public function setMessage($title,$markdown){ |
|
13 | - $this->message = [ |
|
12 | + public function setMessage($title, $markdown) { |
|
13 | + $this->message = [ |
|
14 | 14 | 'msgtype' => 'markdown', |
15 | 15 | 'markdown' => [ |
16 | 16 | 'title' => $title, |
@@ -8,11 +8,11 @@ discard block |
||
8 | 8 | protected $at; |
9 | 9 | |
10 | 10 | |
11 | - public function getMessage(){ |
|
11 | + public function getMessage() { |
|
12 | 12 | return $this->message; |
13 | 13 | } |
14 | 14 | |
15 | - protected function makeAt($mobiles = [],$atAll = false){ |
|
15 | + protected function makeAt($mobiles = [], $atAll = false) { |
|
16 | 16 | return [ |
17 | 17 | 'at' => [ |
18 | 18 | 'atMobiles' => $mobiles, |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | ]; |
22 | 22 | } |
23 | 23 | |
24 | - public function sendAt($mobiles = [],$atAll = false){ |
|
25 | - $this->at = $this->makeAt($mobiles,$atAll); |
|
24 | + public function sendAt($mobiles = [], $atAll = false) { |
|
25 | + $this->at = $this->makeAt($mobiles, $atAll); |
|
26 | 26 | return $this; |
27 | 27 | } |
28 | 28 | |
29 | - public function getBody(){ |
|
29 | + public function getBody() { |
|
30 | 30 | |
31 | - if (empty($this->at)){ |
|
31 | + if (empty($this->at)) { |
|
32 | 32 | $this->sendAt(); |
33 | 33 | } |
34 | 34 | return $this->message + $this->at; |
@@ -6,22 +6,22 @@ |
||
6 | 6 | |
7 | 7 | 'default' => [ |
8 | 8 | // 是否要开启机器人,关闭则不再发送消息 |
9 | - 'enabled' => env('DING_ENABLED',true), |
|
9 | + 'enabled' => env('DING_ENABLED', true), |
|
10 | 10 | // 机器人的access_token |
11 | - 'token' => env('DING_TOKEN',''), |
|
11 | + 'token' => env('DING_TOKEN', ''), |
|
12 | 12 | // 钉钉请求的超时时间 |
13 | - 'timeout' => env('DING_TIME_OUT',2.0), |
|
14 | - 'ssl_verify' => env('DING_SSL_VERIFY',true) |
|
13 | + 'timeout' => env('DING_TIME_OUT', 2.0), |
|
14 | + 'ssl_verify' => env('DING_SSL_VERIFY', true) |
|
15 | 15 | ], |
16 | 16 | |
17 | 17 | 'other' => [ |
18 | - 'enabled' => env('OTHER_DING_ENABLED',true), |
|
18 | + 'enabled' => env('OTHER_DING_ENABLED', true), |
|
19 | 19 | |
20 | - 'token' => env('OTHER_DING_TOKEN',''), |
|
20 | + 'token' => env('OTHER_DING_TOKEN', ''), |
|
21 | 21 | |
22 | - 'timeout' => env('OTHER_DING_TIME_OUT',2.0), |
|
22 | + 'timeout' => env('OTHER_DING_TIME_OUT', 2.0), |
|
23 | 23 | |
24 | - 'ssl_verify' => env('DING_SSL_VERIFY',true) |
|
24 | + 'ssl_verify' => env('DING_SSL_VERIFY', true) |
|
25 | 25 | ] |
26 | 26 | |
27 | 27 | ]; |
28 | 28 | \ No newline at end of file |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | /** |
36 | 36 | * |
37 | 37 | */ |
38 | - public function setAccessToken(){ |
|
38 | + public function setAccessToken() { |
|
39 | 39 | $this->accessToken = $this->config['token']; |
40 | 40 | } |
41 | 41 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * @return string |
57 | 57 | */ |
58 | - public function getRobotUrl(){ |
|
58 | + public function getRobotUrl() { |
|
59 | 59 | return $this->hookUrl . "?access_token={$this->accessToken}"; |
60 | 60 | } |
61 | 61 |