@@ -49,6 +49,7 @@ public function __construct()
4949 * @uses NotifyService::email()
5050 * @uses NotifyService::webhook()
5151 * @uses NotifyService::telegram()
52+ * @uses NotifyService::feishu()
5253 * @uses NotifyService::dingTalk()
5354 * @uses NotifyService::workWechat()
5455 */
@@ -81,10 +82,9 @@ public function handle()
8182 continue ;
8283 }
8384
84- $ content = $ this ->getContent ($ data );
85- $ content = implode ($ type === ConfigNotify::TYPE_EMAIL ? '<br/><br/> ' : "\n\n" , $ content );
86- $ config = $ config = json_decode ($ config ->value , true );
87- $ result = $ service ->$ type ($ content , $ config );
85+ $ config = json_decode ($ config ->value , true );
86+ $ tpl = $ service ->getTemplate ($ type , $ data ['stime ' ], $ data ['etime ' ], $ data ['count ' ]);
87+ $ result = $ service ->$ type ($ tpl ['title ' ], $ tpl ['content ' ], $ config );
8888 $ this ->log ->info ('Send complete ' , array_merge (['type ' => $ type ], $ result ));
8989 }
9090
@@ -106,18 +106,4 @@ private function count($timestamp, $interval)
106106 $ data ['count ' ] = $ query ->count ();
107107 return $ data ;
108108 }
109-
110- /**
111- * @param $data
112- * @return array
113- */
114- private function getContent ($ data )
115- {
116- $ content = [];
117- $ content [] = "码小六消息通知 " ;
118- $ content [] = "开始时间: {$ data ['stime ' ]}" ;
119- $ content [] = "结束时间: {$ data ['etime ' ]}" ;
120- $ content [] = "本时段共有 {$ data ['count ' ]} 条未审记录 " ;
121- return $ content ;
122- }
123109}
0 commit comments