wang hou sheng 8 months ago
parent 71ab749f63
commit 0f192f937c
  1. 15
      app/api/controller/User.php
  2. 9
      app/common/service/qrcode/InviteUser.php
  3. BIN
      app/common/service/qrcode/resource/invite_shop.png

@ -13,11 +13,8 @@ declare (strict_types=1);
namespace app\api\controller; namespace app\api\controller;
use app\api\model\Agreement as AgreementModel; use app\api\model\Agreement as AgreementModel;
use app\api\model\User as UserModel;
use app\api\model\Invite\InviteLog; use app\api\model\Invite\InviteLog;
use app\common\service\qrcode\BaseQRcode; use app\api\model\User as UserModel;
use app\store\model\MaintenanceCategory as MaintenanceCategoryModel;
use app\store\model\User as StoreUserModel;
use app\api\model\user\BalanceLog; use app\api\model\user\BalanceLog;
use app\api\model\user\GoodSource as GoodsSourceModel; use app\api\model\user\GoodSource as GoodsSourceModel;
use app\api\model\user\InvoiceOrder; use app\api\model\user\InvoiceOrder;
@ -26,15 +23,16 @@ use app\api\model\user\UserInvoice;
use app\api\model\UserCoupon as UserCouponModel; use app\api\model\UserCoupon as UserCouponModel;
use app\api\service\Feedback; use app\api\service\Feedback;
use app\api\service\User as UserService; use app\api\service\User as UserService;
use app\common\model\dealer\Order as DealerOrderModel;
use app\common\model\Order as OrderModel;
use app\common\service\qrcode\InviteUser; use app\common\service\qrcode\InviteUser;
use app\store\model\MaintenanceCategory as MaintenanceCategoryModel;
use app\store\model\User as StoreUserModel;
use cores\exception\BaseException; use cores\exception\BaseException;
use think\db\exception\DataNotFoundException; use think\db\exception\DataNotFoundException;
use think\db\exception\DbException; use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException; use think\db\exception\ModelNotFoundException;
use think\response\Json; use think\response\Json;
use think\facade\Db;
use app\common\model\dealer\Order as DealerOrderModel;
use app\common\model\Order as OrderModel;
/** /**
* 用户管理 * 用户管理
@ -318,9 +316,10 @@ class User extends Controller
public function InviteUserPoster(): Json public function InviteUserPoster(): Json
{ {
$userInfo = UserService::getCurrentLoginUser(true); $userInfo = UserService::getCurrentLoginUser(true);
$type = intval($this->request->post('type'), 1);
// 生成二维码 // 生成二维码
$Qrcode = new InviteUser($userInfo, 'MP-WEIXIN'); $Qrcode = new InviteUser($userInfo, 'MP-WEIXIN');
return $this->renderSuccess(['imageUrl' => $Qrcode->getImage()]); return $this->renderSuccess(['imageUrl' => $Qrcode->getImage($type)]);
} }
/** /**

@ -36,14 +36,14 @@ class InviteUser extends BaseQRcode
/** /**
* 拼接海报图 * 拼接海报图
* @param int $type
* @return string * @return string
* @throws BaseException * @throws BaseException
* @throws DataNotFoundException * @throws DataNotFoundException
* @throws DbException * @throws DbException
* @throws ModelNotFoundException * @throws ModelNotFoundException
* @throws Exception
*/ */
public function getImage(): string public function getImage(int $type): string
{ {
// 判断海报图文件存在则直接返回url // 判断海报图文件存在则直接返回url
if (file_exists($this->getPosterPath())) { if (file_exists($this->getPosterPath())) {
@ -51,8 +51,11 @@ class InviteUser extends BaseQRcode
} }
// 商城ID // 商城ID
$storeId = $this->userInfo['store_id']; $storeId = $this->userInfo['store_id'];
// 商品海报背景图
$backdrop = __DIR__ . '/resource/invite_user.png'; $backdrop = __DIR__ . '/resource/invite_user.png';
// 商品海报背景图
if ($type != 1) {
$backdrop = __DIR__ . '/resource/invite_shop.png';
}
// 小程序码参数 // 小程序码参数
$scene = "refereeId:" . ($this->userInfo['user_id'] ?: ''); $scene = "refereeId:" . ($this->userInfo['user_id'] ?: '');
// 下载小程序码 // 下载小程序码

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 KiB

Loading…
Cancel
Save