控制台应用,yzncms本身基于tp5.1框架,里面的队列用不了,bug,坑
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Yzncms [ 御宅男工作室 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2018 http://yzncms.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: 御宅男 <530765310@qq.com>
  10. // +----------------------------------------------------------------------
  11. // +----------------------------------------------------------------------
  12. // | Push操作类
  13. // +----------------------------------------------------------------------
  14. namespace addons\weburlpush\library;
  15. use think\Manager;
  16. class Push extends Manager
  17. {
  18. protected $namespace = '\\addons\\weburlpush\\library\\push\\driver\\';
  19. /**
  20. * 获取一个渠道
  21. * @param string $name
  22. * @return Channel
  23. */
  24. public function channel($name)
  25. {
  26. return $this->driver($name);
  27. }
  28. protected function resolveConfig(string $name)
  29. {
  30. return $this->getChannelConfig($name);
  31. }
  32. public function getChannelConfig(string $channel)
  33. {
  34. if ($config = get_addon_config('weburlpush')) {
  35. return $config[$channel] ?? [];
  36. }
  37. throw new InvalidArgumentException("Channel [$channel] not found.");
  38. }
  39. protected function resolveParams($name): array
  40. {
  41. return array_merge([$name], parent::resolveParams($name));
  42. }
  43. /**
  44. * 默认驱动
  45. * @return string|null
  46. */
  47. public function getDefaultDriver()
  48. {
  49. return null;
  50. }
  51. }