GoodsCategoryLogic.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace app\workerapi\logic;
  3. use app\common\logic\BaseLogic;
  4. use app\common\service\wechat\WeChatConfigService;
  5. use app\common\service\wechat\WeChatMnpService;
  6. use EasyWeChat\MiniApp\Application;
  7. /**
  8. * 服务商品逻辑处理
  9. * Class GoodsCategoryLogic
  10. * @package app\workerapi\logic
  11. */
  12. class GoodsCategoryLogic extends BaseLogic
  13. {
  14. /**
  15. * @return \EasyWeChat\Kernel\HttpClient\Response|false|\Symfony\Contracts\HttpClient\ResponseInterface
  16. */
  17. public static function getQRCode()
  18. {
  19. try {
  20. $config = WeChatConfigService::getMnpConfig();
  21. $app = new Application($config);
  22. $response = $app->getClient()->postJson('/wxa/getwxacodeunlimit', [
  23. 'scene' => 'type=2&id=19',
  24. 'page' => '/pages/good/good',
  25. 'width' => 430,
  26. 'check_path' => false,
  27. 'env_vesion' => 'trial'
  28. ]);
  29. dd($response);
  30. } catch (\Throwable $e) {
  31. // 失败
  32. echo $e->getMessage();
  33. }
  34. }
  35. }