Notify.php 783 B

12345678910111213141516171819202122
  1. <?php namespace Msg\Lib\Type;
  2. use Dever;
  3. class Notify
  4. {
  5. # 发送通知
  6. public function send($template, $account, $param = array())
  7. {
  8. if ($template['content']) {
  9. $template['content'] = \Dever\Helper\Str::val($template['content'], $param);
  10. }
  11. foreach ($template['method'] as $k => $v) {
  12. $handle = Dever::load('method/' . $v, 'msg');
  13. $data['account'] = $handle->init($template['id'], $account);
  14. if ($template['status'] == 1) {
  15. $data['record'] = $handle->send($template['content'], $param);
  16. }
  17. $data['content'] = $template['content'];
  18. Dever::db('notify', 'msg')->insert($data);
  19. }
  20. return '通知发送成功';
  21. }
  22. }