wang hou sheng 7 months ago
parent 9b5455ce41
commit e40a17f3a4
  1. 21
      app/api/controller/User.php
  2. 12
      app/common/service/qrcode/BaseQRcode.php

@ -276,6 +276,7 @@ class User extends Controller
} }
return $this->renderSuccess('提交成功,请耐心等待'); return $this->renderSuccess('提交成功,请耐心等待');
} }
//订单开票 //订单开票
public function invoicingDel(): Json public function invoicingDel(): Json
{ {
@ -376,9 +377,13 @@ class User extends Controller
/** /**
* 生成会员码 * 生成会员码
* [getMembershipInviteQrcode description] * [getMembershipInviteQrcode description]
* @return [type] [description] * @return Json [type] [description]
* @throws BaseException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/ */
public function getMembershipInviteQrcode() public function getMembershipInviteQrcode(): Json
{ {
$user_id = $userInfo = UserService::getCurrentLoginUserId(true); $user_id = $userInfo = UserService::getCurrentLoginUserId(true);
$obj = new \app\common\service\qrcode\BaseQRcode(); $obj = new \app\common\service\qrcode\BaseQRcode();
@ -394,15 +399,19 @@ class User extends Controller
/** /**
* 生成分销商码 * 生成分销商码
* [getDealerInviteQrcode description] * [getDealerInviteQrcode description]
* @return [type] [description] * @return Json [type] [description]
* @throws BaseException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/ */
public function getDealerInviteQrcode() public function getDealerInviteQrcode(): Json
{ {
$storeId = request()->header()['storeid']; $storeId = request()->header()['storeid'];
$user_id = $userInfo = UserService::getCurrentLoginUserId(true); $user_id = $userInfo = UserService::getCurrentLoginUserId(true);
$obj = new \app\common\service\qrcode\BaseQRcode(); $obj = new \app\common\service\qrcode\BaseQRcode();
$scene = 'uid:' . $user_id; $scene = 'refereeId:' . $user_id;
$qrcode = $obj->getQrcode((int)$storeId, $scene, null, 'MP-WEIXIN'); $qrcode = $obj->getQrcode((int)$storeId, $scene, 'pages/login/index', 'MP-WEIXIN');
return $this->renderSuccess(str_replace(root_path() . "public/", base_url(), $qrcode)); return $this->renderSuccess(str_replace(root_path() . "public/", base_url(), $qrcode));
} }

@ -12,12 +12,12 @@ declare (strict_types=1);
namespace app\common\service\qrcode; namespace app\common\service\qrcode;
use app\common\enum\Client as ClientEnum;
use app\common\library\Download;
use app\common\library\wechat\Qrcode as WechatQrcode;
use app\common\model\h5\Setting as H5SettingModel; use app\common\model\h5\Setting as H5SettingModel;
use app\common\model\wxapp\Setting as WxappSettingModel; use app\common\model\wxapp\Setting as WxappSettingModel;
use app\common\service\BaseService; use app\common\service\BaseService;
use app\common\library\Download;
use app\common\library\wechat\Qrcode as WechatQrcode;
use app\common\enum\Client as ClientEnum;
use cores\exception\BaseException; use cores\exception\BaseException;
/** /**
@ -126,12 +126,12 @@ class BaseQRcode extends BaseService
{ {
// 文件目录 // 文件目录
//$dirPath = runtime_root_path() . "image/{$storeId}"; //$dirPath = runtime_root_path() . "image/{$storeId}";
$dirPath = root_path()."public/" . "temp/{$storeId}"; $dirPath = root_path() . "public/" . "temp/$storeId";
!is_dir($dirPath) && mkdir($dirPath, 0755, true); !is_dir($dirPath) && mkdir($dirPath, 0755, true);
// 文件名称 // 文件名称
$fileName = 'qrcode_' . md5("{$storeId}{$scene}{$page}-{$channel}") . '.png'; $fileName = 'qrcode_' . md5("$storeId$scene$page-$channel") . '.png';
// 文件路径 // 文件路径
return "{$dirPath}/{$fileName}"; return "$dirPath/$fileName";
} }
/** /**

Loading…
Cancel
Save