ProgramProvider.php 787 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace crmeb\services\subscribe;
  3. use EasyWeChat\MiniProgram\AccessToken;
  4. use Pimple\Container;
  5. use Pimple\ServiceProviderInterface;
  6. /**
  7. * 注册订阅消息
  8. * Class ProgramProvider
  9. * @package crmeb\utils
  10. */
  11. class ProgramProvider implements ServiceProviderInterface
  12. {
  13. public function register(Container $pimple)
  14. {
  15. $pimple['mini_program.access_token'] = function ($pimple) {
  16. return new AccessToken(
  17. $pimple['config']['mini_program']['app_id'],
  18. $pimple['config']['mini_program']['secret'],
  19. $pimple['cache']
  20. );
  21. };
  22. $pimple['mini_program.now_notice'] = function ($pimple) {
  23. return new ProgramSubscribe($pimple['mini_program.access_token']);
  24. };
  25. }
  26. }