You've already forked think-plugs-notice
[notice]服务类
This commit is contained in:
24
src/service/NoticeService.php
Normal file
24
src/service/NoticeService.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace jerryyan\notice\service;
|
||||||
|
|
||||||
|
|
||||||
|
use jerryyan\notice\model\NoticeNotice;
|
||||||
|
use think\admin\Service;
|
||||||
|
|
||||||
|
class NoticeService extends Service
|
||||||
|
{
|
||||||
|
public static function send_notice_to($type = '', $content = '', $link = '', $users = []): int
|
||||||
|
{
|
||||||
|
$notices = [];
|
||||||
|
foreach ($users as $user) {
|
||||||
|
$notices[] = [
|
||||||
|
'type' => $type,
|
||||||
|
'content' => $content,
|
||||||
|
'link' => $link,
|
||||||
|
'staff_id' => $user,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return NoticeNotice::mk()->insertAll($notices);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user