链街Dcat后台
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.

67 lines
2.0 KiB

  1. <?php
  2. namespace App\Admin\Common;
  3. use Dcat\Admin\Controllers\AdminController;
  4. use EasyWeChat\Factory;
  5. use Intervention\Image\ImageManager;
  6. class StoreQrCode extends AdminController
  7. {
  8. protected $images;
  9. protected $imageManager;
  10. public function __construct()
  11. {
  12. $this->images = new Images();
  13. // $this->imageManager = new ImageManager();
  14. }
  15. /**
  16. * 生成小程序码 永久 还没完成
  17. * @param $scene 参数
  18. * @param $optional
  19. */
  20. public function getUnlimited(string $scene, array $optional = [])
  21. {
  22. $wxCode = Factory::payment(config('wechat.mini_program.default'));
  23. $res = $wxCode->app_code->getUnlimited($scene,$optional);
  24. }
  25. /**
  26. * 生成店铺的微信小程序码
  27. */
  28. public function SetStoreWeChatCode($id)
  29. {
  30. $codeStore = $this->images->createQrCode($id,'zh_cjdianc/pages/takeout/takeoutindex');
  31. $storeImgPath = 'QR_code/code_store_img/wx_store_'.$id.'_'.md5(time()).'.jpg';
  32. $res = $this->images->uploadOss($codeStore,$storeImgPath);
  33. if($res){
  34. return ['status' => true ,'path' => $storeImgPath];
  35. }else{
  36. return ['status' => false ,'path' => ''];
  37. }
  38. }
  39. /**
  40. * 生成店铺收银的微信二维码
  41. */
  42. public function SetPayWeChatCode($id)
  43. {
  44. if(config('wechat.QR_code.default.is_wx_code') == 1){
  45. $codeStore = $this->images->createWeChatQrCode('?scene='.$id,'zh_cjdianc/pages/seller/fukuan');
  46. $storeImgPath = 'QR_code/code_pay_img/wx_pay_'.$id.'_'.md5(time()).'.jpg';
  47. }else{
  48. $codeStore = $this->images->createQrCode($id,'zh_cjdianc/pages/seller/fukuan');
  49. $storeImgPath = 'QR_code/code_minipay_img/wx_minipay_'.$id.'_'.md5(time()).'.jpg';
  50. }
  51. $res = $this->images->uploadOss($codeStore,$storeImgPath);
  52. if($res){
  53. return ['status' => true ,'path' => $storeImgPath];
  54. }else{
  55. return ['status' => false ,'path' => ''];
  56. }
  57. }
  58. }