链街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

<?php
namespace App\Admin\Common;
use Dcat\Admin\Controllers\AdminController;
use EasyWeChat\Factory;
use Intervention\Image\ImageManager;
class StoreQrCode extends AdminController
{
protected $images;
protected $imageManager;
public function __construct()
{
$this->images = new Images();
// $this->imageManager = new ImageManager();
}
/**
* 生成小程序码 永久 还没完成
* @param $scene 参数
* @param $optional
*/
public function getUnlimited(string $scene, array $optional = [])
{
$wxCode = Factory::payment(config('wechat.mini_program.default'));
$res = $wxCode->app_code->getUnlimited($scene,$optional);
}
/**
* 生成店铺的微信小程序码
*/
public function SetStoreWeChatCode($id)
{
$codeStore = $this->images->createQrCode($id,'zh_cjdianc/pages/takeout/takeoutindex');
$storeImgPath = 'QR_code/code_store_img/wx_store_'.$id.'_'.md5(time()).'.jpg';
$res = $this->images->uploadOss($codeStore,$storeImgPath);
if($res){
return ['status' => true ,'path' => $storeImgPath];
}else{
return ['status' => false ,'path' => ''];
}
}
/**
* 生成店铺收银的微信二维码
*/
public function SetPayWeChatCode($id)
{
if(config('wechat.QR_code.default.is_wx_code') == 1){
$codeStore = $this->images->createWeChatQrCode('?scene='.$id,'zh_cjdianc/pages/seller/fukuan');
$storeImgPath = 'QR_code/code_pay_img/wx_pay_'.$id.'_'.md5(time()).'.jpg';
}else{
$codeStore = $this->images->createQrCode($id,'zh_cjdianc/pages/seller/fukuan');
$storeImgPath = 'QR_code/code_minipay_img/wx_minipay_'.$id.'_'.md5(time()).'.jpg';
}
$res = $this->images->uploadOss($codeStore,$storeImgPath);
if($res){
return ['status' => true ,'path' => $storeImgPath];
}else{
return ['status' => false ,'path' => ''];
}
}
}