@@ -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; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @param $config |
26 | 26 | * @param SendClient $client |
27 | 27 | */ |
28 | - public function __construct($config,$client = null) |
|
28 | + public function __construct($config, $client = null) |
|
29 | 29 | { |
30 | 30 | $this->config = $config; |
31 | 31 | $this->client = $client; |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | * @param string $robot |
37 | 37 | * @return $this |
38 | 38 | */ |
39 | - public function with($robot = 'default'){ |
|
39 | + public function with($robot = 'default') { |
|
40 | 40 | $this->robot = $robot; |
41 | - $this->dingTalkService = new DingTalkService($this->config[$robot],$this->client); |
|
41 | + $this->dingTalkService = new DingTalkService($this->config[$robot], $this->client); |
|
42 | 42 | return $this; |
43 | 43 | } |
44 | 44 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @param string $content |
48 | 48 | * @return mixed |
49 | 49 | */ |
50 | - public function text($content = ''){ |
|
50 | + public function text($content = '') { |
|
51 | 51 | return $this->dingTalkService |
52 | 52 | ->setTextMessage($content) |
53 | 53 | ->send(); |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | * @param $text |
59 | 59 | * @return mixed |
60 | 60 | */ |
61 | - public function action($title, $text){ |
|
61 | + public function action($title, $text) { |
|
62 | 62 | return $this->dingTalkService |
63 | - ->setActionCardMessage($title,$text); |
|
63 | + ->setActionCardMessage($title, $text); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | * @param bool $atAll |
69 | 69 | * @return $this |
70 | 70 | */ |
71 | - public function at($mobiles = [], $atAll = false){ |
|
71 | + public function at($mobiles = [], $atAll = false) { |
|
72 | 72 | $this->dingTalkService |
73 | - ->setAt($mobiles,$atAll); |
|
73 | + ->setAt($mobiles, $atAll); |
|
74 | 74 | return $this; |
75 | 75 | } |
76 | 76 | |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | * @param string $picUrl |
82 | 82 | * @return mixed |
83 | 83 | */ |
84 | - public function link($title, $text, $url, $picUrl = ''){ |
|
84 | + public function link($title, $text, $url, $picUrl = '') { |
|
85 | 85 | return $this->dingTalkService |
86 | - ->setLinkMessage($title,$text,$url,$picUrl) |
|
86 | + ->setLinkMessage($title, $text, $url, $picUrl) |
|
87 | 87 | ->send(); |
88 | 88 | } |
89 | 89 | |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | * @param $markdown |
93 | 93 | * @return mixed |
94 | 94 | */ |
95 | - public function markdown($title, $markdown){ |
|
95 | + public function markdown($title, $markdown) { |
|
96 | 96 | return $this->dingTalkService |
97 | - ->setMarkdownMessage($title,$markdown) |
|
97 | + ->setMarkdownMessage($title, $markdown) |
|
98 | 98 | ->send(); |
99 | 99 | } |
100 | 100 | |
@@ -105,15 +105,15 @@ discard block |
||
105 | 105 | * @param int $btnOrientation |
106 | 106 | * @return mixed |
107 | 107 | */ |
108 | - public function actionCard($title, $markdown, $hideAvatar = 0, $btnOrientation = 0){ |
|
108 | + public function actionCard($title, $markdown, $hideAvatar = 0, $btnOrientation = 0) { |
|
109 | 109 | return $this->dingTalkService |
110 | - ->setActionCardMessage($title,$markdown,$hideAvatar,$btnOrientation); |
|
110 | + ->setActionCardMessage($title, $markdown, $hideAvatar, $btnOrientation); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
114 | 114 | * @return mixed |
115 | 115 | */ |
116 | - public function feed(){ |
|
116 | + public function feed() { |
|
117 | 117 | return $this->dingTalkService |
118 | 118 | ->setFeedCardMessage(); |
119 | 119 | } |
@@ -6,26 +6,26 @@ |
||
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), |
|
13 | + 'timeout' => env('DING_TIME_OUT', 2.0), |
|
14 | 14 | // 是否开启ss认证 |
15 | - 'ssl_verify' => env('DING_SSL_VERIFY',true), |
|
15 | + 'ssl_verify' => env('DING_SSL_VERIFY', true), |
|
16 | 16 | // 开启安全配置 |
17 | - 'secret' => env('DING_SECRET',true), |
|
17 | + 'secret' => env('DING_SECRET', true), |
|
18 | 18 | ], |
19 | 19 | |
20 | 20 | 'other' => [ |
21 | - 'enabled' => env('OTHER_DING_ENABLED',true), |
|
21 | + 'enabled' => env('OTHER_DING_ENABLED', true), |
|
22 | 22 | |
23 | - 'token' => env('OTHER_DING_TOKEN',''), |
|
23 | + 'token' => env('OTHER_DING_TOKEN', ''), |
|
24 | 24 | |
25 | - 'timeout' => env('OTHER_DING_TIME_OUT',2.0), |
|
25 | + 'timeout' => env('OTHER_DING_TIME_OUT', 2.0), |
|
26 | 26 | |
27 | - 'ssl_verify' => env('DING_SSL_VERIFY',true), |
|
27 | + 'ssl_verify' => env('DING_SSL_VERIFY', true), |
|
28 | 28 | |
29 | - 'secret' => env('DING_SECRET',true), |
|
29 | + 'secret' => env('DING_SECRET', true), |
|
30 | 30 | ] |
31 | 31 | ]; |