Qrcode.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace addon\weapp\event;
  11. use addon\weapp\model\Weapp;
  12. /**
  13. * 二维码
  14. */
  15. class Qrcode
  16. {
  17. /**
  18. * 二维码生成获取
  19. */
  20. public function handle($param)
  21. {
  22. if ($param["app_type"] == 'weapp' || $param["app_type"] == 'all') {
  23. if ($param["app_type"] == 'all') $param["app_type"] = 'weapp';
  24. $weapp = new Weapp($param['site_id']);
  25. if ($param["type"] == 'create') {
  26. $res = $weapp->createQrcode($param);
  27. } else {
  28. $filename = $param['qrcode_path'] . '/' . $param['qrcode_name'] . '_' . $param['app_type'] . '.png';
  29. if (file_exists($filename)) {
  30. $res = success(0, '', ['type' => 'weapp', 'path' => $filename]);
  31. } else {
  32. $res = $weapp->createQrcode($param);
  33. }
  34. }
  35. return $res;
  36. }
  37. }
  38. }