|
@@ -13,82 +13,86 @@ class Userintro extends Api
|
|
protected $noNeedRight = ['*'];
|
|
protected $noNeedRight = ['*'];
|
|
|
|
|
|
|
|
|
|
- //生成我的视频海报
|
|
|
|
- //生成邀请码二维码图片
|
|
|
|
- public function inviteimage() {
|
|
|
|
- $params['text'] = config('app_download_url') . '/index/index/appdownload';
|
|
|
|
- $qrcode_service = \addons\qrcode\library\Service::qrcode($params);
|
|
|
|
-// $mimetype = 'image/png';
|
|
|
|
-// $response = Response::create()->header("Content-Type", $mimetype);
|
|
|
|
-
|
|
|
|
- // 直接显示二维码
|
|
|
|
-// header('Content-Type: ' . $qrcode_service->getContentType());
|
|
|
|
-// $response->content($qrcode_service->writeString());
|
|
|
|
- $qrcodePath = ROOT_PATH . 'public/uploads/qrcode/';
|
|
|
|
- if (!is_dir($qrcodePath)) {
|
|
|
|
- @mkdir($qrcodePath);
|
|
|
|
- }
|
|
|
|
- if (is_really_writable($qrcodePath)) {
|
|
|
|
- $filename = md5(implode('', $params)) . '.png';
|
|
|
|
- $filePath = $qrcodePath . $filename;
|
|
|
|
- $qrcode_service->writeFile($filePath);
|
|
|
|
- }
|
|
|
|
|
|
+ //生成海报
|
|
|
|
+ public function createposter() {
|
|
|
|
+// $image = input('image', '', 'trim');
|
|
|
|
+// if (!$image) {
|
|
|
|
+// $this->error('您的网络开小差啦~');
|
|
|
|
+// }
|
|
|
|
+ $image = config('site.intro_imges');
|
|
|
|
+ $haibao = $this->haibao($this->auth->id,['invite_no'=>$this->auth->invite_no, 'background' => $image]);
|
|
|
|
+ return $haibao;
|
|
|
|
+// $this->success('success', $haibao);
|
|
|
|
+ }
|
|
|
|
|
|
- return '/uploads/qrcode/' . $filename;
|
|
|
|
|
|
+ //海报
|
|
|
|
+ public function haibao($player_id,$data){
|
|
|
|
+
|
|
|
|
+ //下载页二维码,没必要保留
|
|
|
|
+ $httpStr = $_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'];
|
|
|
|
+ $params = [
|
|
|
|
+ 'text' => $httpStr.'/index/index/appdownload?code=' . $data['invite_no'],
|
|
|
|
+ 'size' => 90,
|
|
|
|
+ 'logo' => false,
|
|
|
|
+ 'label' => false,
|
|
|
|
+ 'padding' => 0,
|
|
|
|
+ ];
|
|
|
|
+ $qrCode = \addons\qrcode\library\Service::qrcode($params);
|
|
|
|
+ $qrcode_path = 'uploads/hbplayer/'.date('Ymd');
|
|
|
|
+ mk_dir($qrcode_path);
|
|
|
|
+ $download_qrcode = $qrcode_path.'/download'.$player_id.'.png';
|
|
|
|
+ $qrCode->writeFile($download_qrcode);
|
|
|
|
+
|
|
|
|
+ //海报
|
|
|
|
+ $result['url'] = $this->createhaibao($download_qrcode,$player_id,$data);
|
|
|
|
+
|
|
|
|
+ $this->success('获取成功',$result);
|
|
}
|
|
}
|
|
|
|
|
|
- //生成视频分享海报
|
|
|
|
- public function shareposter() {
|
|
|
|
- $inviteimage = $this->inviteimage($this->auth->introcode);
|
|
|
|
|
|
+ public function createhaibao($download_qrcode,$player_id,$sub_data){
|
|
|
|
+ //二维码
|
|
|
|
+ $httpStr = $_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'];
|
|
|
|
+ $download_qrcode= $httpStr.'/'.$download_qrcode;
|
|
|
|
|
|
$data = [
|
|
$data = [
|
|
|
|
+
|
|
[
|
|
[
|
|
- "left"=> "140px",
|
|
|
|
- "top"=> "120px",
|
|
|
|
- "type"=> "img",
|
|
|
|
- "width"=> "50px",
|
|
|
|
- "height"=> "50px",
|
|
|
|
- "src"=> localpath_to_netpath($this->auth->avatar)//"https://metavision.oss-cn-hongkong.aliyuncs.com/uploads/20220615/f00cb545deb4c4e7296f444239d83e84.jpg"
|
|
|
|
- ],
|
|
|
|
- [
|
|
|
|
- "left"=> "95px",
|
|
|
|
- "top"=> "190px",
|
|
|
|
- "type"=> "nickname",
|
|
|
|
- "width"=> "166px",
|
|
|
|
- "height"=> "38px",
|
|
|
|
- "size"=> "11px",
|
|
|
|
- "color"=> "#FFFFFF",
|
|
|
|
- "content" => '这里真心不错,推荐你来',
|
|
|
|
|
|
+ "left" => "18px",
|
|
|
|
+ "top" => "410px",
|
|
|
|
+ "type" => "text",
|
|
|
|
+ "width" => "80px",
|
|
|
|
+ "height" => "24px",
|
|
|
|
+ "size" => "16px",
|
|
|
|
+ "color" => "#123354",
|
|
|
|
+ "content" => 'K歌社交'
|
|
],
|
|
],
|
|
[
|
|
[
|
|
- "left"=> "105px",
|
|
|
|
- "top"=> "400px",
|
|
|
|
- "type"=> "nickname",
|
|
|
|
- "width"=> "166px",
|
|
|
|
- "height"=> "38px",
|
|
|
|
- "size"=> "11px",
|
|
|
|
- "color"=> "#333333",
|
|
|
|
- "content" => '邀请码:'.$this->auth->introcode,
|
|
|
|
|
|
+ "left" => "18px",
|
|
|
|
+ "top" => "445px",
|
|
|
|
+ "type" => "text",
|
|
|
|
+ "width" => "80px",
|
|
|
|
+ "height" => "24px",
|
|
|
|
+ "size" => "10px",
|
|
|
|
+ "color" => "#123354",
|
|
|
|
+ "content" => '更多金币奖励等你来拿'
|
|
],
|
|
],
|
|
[
|
|
[
|
|
- "left"=> "100px",
|
|
|
|
- "top"=> "265px",
|
|
|
|
- "type"=> "img",
|
|
|
|
- "width"=> "130px",
|
|
|
|
- "height"=> "130px",
|
|
|
|
- "src"=> httpurllocal($inviteimage)//"https://metavision.oss-cn-hongkong.aliyuncs.com/uploads/20220615/f00cb545deb4c4e7296f444239d83e84.jpg"
|
|
|
|
- ],
|
|
|
|
-
|
|
|
|
|
|
+ "left" => "210px",
|
|
|
|
+ "top" => "385px",
|
|
|
|
+ "type" => "img",
|
|
|
|
+ "width" => "95px",
|
|
|
|
+ "height" => "95px",
|
|
|
|
+ "src" => $download_qrcode//"https://metavision.oss-cn-hongkong.aliyuncs.com/uploads/20220615/f00cb545deb4c4e7296f444239d83e84.jpg"
|
|
|
|
+ ]
|
|
];
|
|
];
|
|
|
|
|
|
-
|
|
|
|
$data = json_encode($data, 320);
|
|
$data = json_encode($data, 320);
|
|
|
|
|
|
$poster = [
|
|
$poster = [
|
|
- 'id' => 1,
|
|
|
|
- 'title' => '测试',
|
|
|
|
|
|
+ 'id' => $player_id,
|
|
|
|
+ 'title' => 'K歌',
|
|
'waittext' => '您的专属海报正在拼命生成中,请等待片刻...',
|
|
'waittext' => '您的专属海报正在拼命生成中,请等待片刻...',
|
|
- 'bg_image' => '/assets/img/posteruserbg.png',
|
|
|
|
|
|
+ 'bg_image' => $sub_data['background'] ? cdnurl($sub_data['background']) : '/assets/img/inviteposter.png',
|
|
'data' => $data,
|
|
'data' => $data,
|
|
'status' => 'normal',
|
|
'status' => 'normal',
|
|
'weigh' => 0,
|
|
'weigh' => 0,
|
|
@@ -102,11 +106,8 @@ class Userintro extends Api
|
|
if (!$imgurl) {
|
|
if (!$imgurl) {
|
|
$this->error('生成海报出错');
|
|
$this->error('生成海报出错');
|
|
}
|
|
}
|
|
- $imgurl = $_SERVER["REQUEST_SCHEME"]."://".$_SERVER["HTTP_HOST"] . '/' . $imgurl;
|
|
|
|
-
|
|
|
|
- //echo '<html><body><img src="'.$imgurl.'"></body></html>';
|
|
|
|
-
|
|
|
|
- $this->success('', $imgurl);
|
|
|
|
|
|
+// $imgurl = $_SERVER["REQUEST_SCHEME"]."://".$_SERVER["HTTP_HOST"] . '/' . $imgurl;
|
|
|
|
+ return $httpStr.'/' . $imgurl;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|