MaterialBehavior.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace behavior\wechat;
  12. use think\Db;
  13. /**
  14. * 素材消息行为
  15. * Class MaterialBehavior
  16. * @package behavior\wechat
  17. */
  18. class MaterialBehavior
  19. {
  20. public static function db()
  21. {
  22. return Db::name('WechatMedia');
  23. }
  24. public static function wechatMaterialAfter($data,$type)
  25. {
  26. $data['type'] = $type;
  27. $data['add_time'] = time();
  28. $data['temporary'] = 0;
  29. self::db()->insert($data);
  30. }
  31. public static function wechatMaterialTemporaryAfter($data,$type)
  32. {
  33. $data['type'] = $type;
  34. $data['add_time'] = time();
  35. $data['temporary'] = 1;
  36. self::db()->insert($data);
  37. }
  38. }