diff --git a/app/api/controller/User.php b/app/api/controller/User.php index dffff591..7328e71d 100644 --- a/app/api/controller/User.php +++ b/app/api/controller/User.php @@ -276,6 +276,7 @@ class User extends Controller } return $this->renderSuccess('提交成功,请耐心等待'); } + //订单开票 public function invoicingDel(): Json { @@ -285,7 +286,7 @@ class User extends Controller } return $this->renderSuccess('提交成功,请耐心等待'); } - + /** * 个人中心协议 */ @@ -376,9 +377,13 @@ class User extends Controller /** * 生成会员码 * [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); $obj = new \app\common\service\qrcode\BaseQRcode(); @@ -394,15 +399,19 @@ class User extends Controller /** * 生成分销商码 * [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']; $user_id = $userInfo = UserService::getCurrentLoginUserId(true); $obj = new \app\common\service\qrcode\BaseQRcode(); - $scene = 'uid:' . $user_id; - $qrcode = $obj->getQrcode((int)$storeId, $scene, null, 'MP-WEIXIN'); + $scene = 'refereeId:' . $user_id; + $qrcode = $obj->getQrcode((int)$storeId, $scene, 'pages/login/index', 'MP-WEIXIN'); return $this->renderSuccess(str_replace(root_path() . "public/", base_url(), $qrcode)); } diff --git a/app/common/service/qrcode/BaseQRcode.php b/app/common/service/qrcode/BaseQRcode.php index 4733661f..11841bed 100644 --- a/app/common/service/qrcode/BaseQRcode.php +++ b/app/common/service/qrcode/BaseQRcode.php @@ -12,12 +12,12 @@ declare (strict_types=1); 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\wxapp\Setting as WxappSettingModel; 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; /** @@ -48,7 +48,7 @@ class BaseQRcode extends BaseService return $this->getH5Qrcode($storeId, $scene, $page, $channel); } - public function getOtherQrcode(int $storeId, string $url, string $channel = 'H5'): string + public function getOtherQrcode(int $storeId, string $url, string $channel = 'H5'): string { // 根据指定渠道生成不同的二维码 $savePath = $this->getFilePath($storeId, $url, "", $channel); @@ -126,12 +126,12 @@ class BaseQRcode extends BaseService { // 文件目录 //$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); // 文件名称 - $fileName = 'qrcode_' . md5("{$storeId}{$scene}{$page}-{$channel}") . '.png'; + $fileName = 'qrcode_' . md5("$storeId$scene$page-$channel") . '.png'; // 文件路径 - return "{$dirPath}/{$fileName}"; + return "$dirPath/$fileName"; } /**