|
@@ -258,73 +258,27 @@ class UserBillController
|
|
|
SystemAttachment::where(['name' => $name])->delete();
|
|
SystemAttachment::where(['name' => $name])->delete();
|
|
|
}
|
|
}
|
|
|
if (!$imageInfo) {
|
|
if (!$imageInfo) {
|
|
|
-// $qr_code = QrcodeService::getForeverQrcode('spread', $user['uid']);
|
|
|
|
|
-// if (isset($qr_code['url'])) {
|
|
|
|
|
-// $urlCode = $qr_code['url'];
|
|
|
|
|
-// } else {
|
|
|
|
|
- $codeUrl = set_http_type($siteUrl . '/index/#/pages/public/register/?spread=' . $user['uid'], 1);//二维码链接
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ $qr_code = QrcodeService::getForeverQrcode('spread', $user['uid']);
|
|
|
|
|
+ if (isset($qr_code['url'])) {
|
|
|
|
|
+ $urlCode = $qr_code['url'];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $codeUrl = set_http_type($siteUrl . '?spread=' . $user['uid'], 1);//二维码链接
|
|
|
|
|
+ $imageInfo = UtilService::getQRCodePath($codeUrl, $name);
|
|
|
|
|
+ if (is_string($imageInfo)) return app('json')->fail('二维码生成失败', ['error' => $imageInfo]);
|
|
|
|
|
+ SystemAttachment::attachmentAdd($imageInfo['name'], $imageInfo['size'], $imageInfo['type'], $imageInfo['dir'], $imageInfo['thumb_path'], 1, $imageInfo['image_type'], $imageInfo['time'], 2);
|
|
|
|
|
+ $urlCode = $imageInfo['dir'];
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (\Exception $e) {
|
|
|
|
|
+ $codeUrl = set_http_type($siteUrl . '?spread=' . $user['uid'], 1);//二维码链接
|
|
|
$imageInfo = UtilService::getQRCodePath($codeUrl, $name);
|
|
$imageInfo = UtilService::getQRCodePath($codeUrl, $name);
|
|
|
if (is_string($imageInfo)) return app('json')->fail('二维码生成失败', ['error' => $imageInfo]);
|
|
if (is_string($imageInfo)) return app('json')->fail('二维码生成失败', ['error' => $imageInfo]);
|
|
|
SystemAttachment::attachmentAdd($imageInfo['name'], $imageInfo['size'], $imageInfo['type'], $imageInfo['dir'], $imageInfo['thumb_path'], 1, $imageInfo['image_type'], $imageInfo['time'], 2);
|
|
SystemAttachment::attachmentAdd($imageInfo['name'], $imageInfo['size'], $imageInfo['type'], $imageInfo['dir'], $imageInfo['thumb_path'], 1, $imageInfo['image_type'], $imageInfo['time'], 2);
|
|
|
$urlCode = $imageInfo['dir'];
|
|
$urlCode = $imageInfo['dir'];
|
|
|
-// }
|
|
|
|
|
|
|
+ }
|
|
|
} else $urlCode = $imageInfo['att_dir'];
|
|
} else $urlCode = $imageInfo['att_dir'];
|
|
|
if ($imageInfo['image_type'] == 1) $urlCode = $siteUrl . $urlCode;
|
|
if ($imageInfo['image_type'] == 1) $urlCode = $siteUrl . $urlCode;
|
|
|
$siteUrl = set_http_type($siteUrl, 1);
|
|
$siteUrl = set_http_type($siteUrl, 1);
|
|
|
- $filelink = [
|
|
|
|
|
- 'Bold' => 'static' . DS . 'font' . DS . 'Alibaba-PuHuiTi-Regular.otf',
|
|
|
|
|
- 'Normal' => 'static' . DS . 'font' . DS . 'Alibaba-PuHuiTi-Regular.otf',
|
|
|
|
|
- ];
|
|
|
|
|
- if (!file_exists($filelink['Bold'])) return app('json')->fail('缺少字体文件Bold');
|
|
|
|
|
- if (!file_exists($filelink['Normal'])) return app('json')->fail('缺少字体文件Normal');
|
|
|
|
|
- foreach ($routineSpreadBanner as $key => &$item) {
|
|
|
|
|
- $posterInfo = '海报生成失败:(';
|
|
|
|
|
- $config = array(
|
|
|
|
|
- 'image' => array(
|
|
|
|
|
- array(
|
|
|
|
|
- 'url' => $urlCode, //二维码资源
|
|
|
|
|
- 'stream' => 0,
|
|
|
|
|
- 'left' => 225,
|
|
|
|
|
- 'top' => 913,
|
|
|
|
|
- 'right' => 0,
|
|
|
|
|
- 'bottom' => 0,
|
|
|
|
|
- 'width' => 300,
|
|
|
|
|
- 'height' => 300,
|
|
|
|
|
- 'opacity' => 100
|
|
|
|
|
- )
|
|
|
|
|
- ),
|
|
|
|
|
- 'text' => array(
|
|
|
|
|
- array(
|
|
|
|
|
- 'text' => $user['nickname'],
|
|
|
|
|
- 'left' => 250,
|
|
|
|
|
- 'top' => 840,
|
|
|
|
|
- 'fontPath' => $rootPath . 'public' . DS . $filelink['Bold'], //字体文件
|
|
|
|
|
- 'fontSize' => 16, //字号
|
|
|
|
|
- 'fontColor' => '40,40,40', //字体颜色
|
|
|
|
|
- 'angle' => 0,
|
|
|
|
|
- ),
|
|
|
|
|
- array(
|
|
|
|
|
- 'text' => '邀请您加入' . sys_config('site_name'),
|
|
|
|
|
- 'left' => 250,
|
|
|
|
|
- 'top' => 880,
|
|
|
|
|
- 'fontPath' => $rootPath . 'public' . DS . $filelink['Normal'], //字体文件
|
|
|
|
|
- 'fontSize' => 16, //字号
|
|
|
|
|
- 'fontColor' => '40,40,40', //字体颜色
|
|
|
|
|
- 'angle' => 0,
|
|
|
|
|
- )
|
|
|
|
|
- ),
|
|
|
|
|
- 'background' => $item['pic']
|
|
|
|
|
- );
|
|
|
|
|
- $resWap = $resWap && $posterInfo = UtilService::setSharePoster($config, 'wap/spread/poster');
|
|
|
|
|
- if (!is_array($posterInfo)) return app('json')->fail($posterInfo);
|
|
|
|
|
- SystemAttachment::attachmentAdd($posterInfo['name'], $posterInfo['size'], $posterInfo['type'], $posterInfo['dir'], $posterInfo['thumb_path'], 1, $posterInfo['image_type'], $posterInfo['time'], 2);
|
|
|
|
|
- if ($resWap) {
|
|
|
|
|
- if ($posterInfo['image_type'] == 1)
|
|
|
|
|
- $item['wap_poster'] = $siteUrl . $posterInfo['thumb_path'];
|
|
|
|
|
- else
|
|
|
|
|
- $item['wap_poster'] = UtilService::setHttpType($posterInfo['thumb_path'], 1);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
if ($resRoutine && $resWap) return app('json')->successful($routineSpreadBanner);
|
|
if ($resRoutine && $resWap) return app('json')->successful($routineSpreadBanner);
|
|
|
else return app('json')->fail('生成图片失败');
|
|
else return app('json')->fail('生成图片失败');
|