|
|
|
@ -19,15 +19,18 @@ class InviteUser extends BaseQRcode |
|
|
|
|
// 用户信息 |
|
|
|
|
private UserModel $userInfo; |
|
|
|
|
|
|
|
|
|
private int $type = 1; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 构造方法 |
|
|
|
|
* Goods constructor. |
|
|
|
|
* @param UserModel $userInfo |
|
|
|
|
* @param string $channel 二维码渠道(小程序码、h5码) |
|
|
|
|
*/ |
|
|
|
|
public function __construct(UserModel $userInfo, string $channel = 'H5') |
|
|
|
|
public function __construct(UserModel $userInfo, string $channel = 'H5', int $type = 1) |
|
|
|
|
{ |
|
|
|
|
parent::__construct(); |
|
|
|
|
$this->type = $type; |
|
|
|
|
// 用户信息 |
|
|
|
|
$this->userInfo = $userInfo; |
|
|
|
|
// 当前客户端 |
|
|
|
@ -36,14 +39,13 @@ class InviteUser extends BaseQRcode |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 拼接海报图 |
|
|
|
|
* @param int $type |
|
|
|
|
* @return string |
|
|
|
|
* @throws BaseException |
|
|
|
|
* @throws DataNotFoundException |
|
|
|
|
* @throws DbException |
|
|
|
|
* @throws ModelNotFoundException |
|
|
|
|
*/ |
|
|
|
|
public function getImage(int $type): string |
|
|
|
|
public function getImage(): string |
|
|
|
|
{ |
|
|
|
|
// 判断海报图文件存在则直接返回url |
|
|
|
|
if (file_exists($this->getPosterPath())) { |
|
|
|
@ -53,7 +55,7 @@ class InviteUser extends BaseQRcode |
|
|
|
|
$storeId = $this->userInfo['store_id']; |
|
|
|
|
$backdrop = __DIR__ . '/resource/invite_user.png'; |
|
|
|
|
// 商品海报背景图 |
|
|
|
|
if ($type != 1) { |
|
|
|
|
if ($this->type != 1) { |
|
|
|
|
$backdrop = __DIR__ . '/resource/invite_shop.png'; |
|
|
|
|
} |
|
|
|
|
// 小程序码参数 |
|
|
|
@ -107,7 +109,7 @@ class InviteUser extends BaseQRcode |
|
|
|
|
*/ |
|
|
|
|
private function getPosterName(): string |
|
|
|
|
{ |
|
|
|
|
return 'invite_' . md5("{$this->userInfo['user_id']}_$this->channel") . '.png'; |
|
|
|
|
return 'invite_' . md5("{$this->userInfo['user_id']}_$this->channel_$this->type") . '.png'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|