MaterialSubscribe.php 546 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace crmeb\subscribes;
  3. use think\facade\Db;
  4. /**
  5. * 素材消息事件
  6. * Class MaterialSubscribe
  7. * @package crmeb\subscribes
  8. */
  9. class MaterialSubscribe
  10. {
  11. public function handle()
  12. {
  13. }
  14. /**
  15. * 图片/声音 转media 存入数据库
  16. * @param $event
  17. */
  18. public function onWechatMaterialAfter($event)
  19. {
  20. list($data, $type) = $event;
  21. $data['type'] = $type;
  22. $data['add_time'] = time();
  23. $data['temporary'] = 0;
  24. Db::name('WechatMedia')->insert($data);
  25. }
  26. }