增加:公共二维码生成方法

This commit is contained in:
wuhui_zzw 2024-06-14 11:09:19 +08:00
parent cf7282cc5d
commit b55097f1b8
1 changed files with 52 additions and 1 deletions

View File

@ -31,6 +31,7 @@ use crmeb\basic\BaseController;
use crmeb\services\AlipayService;
use crmeb\services\CopyCommand;
use crmeb\services\MiniProgramService;
use crmeb\services\QrcodeService;
use crmeb\services\UploadService;
use crmeb\services\WechatService;
use Exception;
@ -316,7 +317,7 @@ class Common extends BaseController
*/
public function get_image_base64()
{
list($imageUrl, $codeUrl) = $this->request->params([
[$imageUrl, $codeUrl] = $this->request->params([
['image', ''],
['code', ''],
], true);
@ -562,4 +563,54 @@ class Common extends BaseController
return app('json')->success($data);
}
// 获取小程序码
public function getQrCode(){
// 参数获取
$uid = $this->request->uid();
$params = $this->request->params(['agent_id','type','level','merchant_type','mer_id']);
// 小程序码生成
$qrcode = '';
switch($params['type']){
// 运营中心 - 邀请供应商
case 'agent_supplier':
$valueData = 'agent_id=' . $params['agent_id'];
$path = 'pages/supplier/apply/apply_join';
$qrcode = app()->make(QrcodeService::class)->createQrCode($valueData,$path);
break;
// 运营中心 - 邀请下级代理
case 'agent_subordinate':
// 参数长度超过 简写lv=levelagent_id=aid
$valueData = 'lv=' . $params['level'] . '&aid=' . $params['agent_id'];
$path = 'pages/agent/invite/index';
$qrcode = app()->make(QrcodeService::class)->createQrCode($valueData,$path);
break;
// 运营中心 - 邀请商户
case 'agent_merchant':
// 参数长度超过 简写aid=agent_idmt=merchant_type
$valueData = 'aid=' . $params['agent_id'].'&mt=' . $params['merchant_type'];
$path = 'pages/store/settled/index';
$qrcode = app()->make(QrcodeService::class)->createQrCode($valueData,$path);
break;
// 共创股东 - 邀请股东加入
case 'mer_shareholder_invite':
// 参数长度超过 简写lv=levelmid=mer_id
$valueData = 'lv=' . $params['level'].'&mid=' . $params['mer_id'];
$path = 'pages/admin/business/shareholder/confirm_join';
$qrcode = app()->make(QrcodeService::class)->createQrCode($valueData,$path);
break;
}
// 信息输出
if($qrcode) return app('json')->success(['qr_code' => $qrcode]);
else throw new ValidateException('小程序码生成失败!');
}
}