作者 王晓刚
1 个管道 的构建 通过 耗费 0 秒

海报

... ... @@ -33,27 +33,37 @@ class ShareController extends WeChatBaseController
if($my_user['is_pro'] != 1){
$this->error('无权限','','','');
}
/* if(empty($my_user['phone'])){
$this->redirect('information');
}*/
/* if(empty($my_user['phone'])){
$this->redirect('information');
}*/
//判断有没有生成过
// if(!file_exists('./upload/poster/poster_'.$user_id.".png")){
$url = $this->get_url($my_user['id'],$my_user['status']);
$webPath = 'qrcode/code_img'.$user_id.$my_user['status'].'.png';
$savePath = './upload/'.$webPath;
//生成带参二维码
$url = $this->get_url($my_user['id'],$my_user['status']);
$webPath = 'qrcode/code_img'.$user_id.$my_user['status'].'.png';
$savePath = './upload/'.$webPath;
//生成带参二维码
if(!file_exists($savePath)){
$prcode_url = $this->code_img($my_user['id'],$my_user['status']);
}
$savePath = './upload/poster';
if(!file_exists($savePath)){
mkdir ($savePath,0777,true);
}
if($my_user['status'] == 3){
//老师
$image = \think\Image::open(ROOT_PATH."public/upload/qrcode/code_img".$user_id.$my_user['status'].".png");
$image->thumb(300,300,\think\Image::THUMB_FIXED)->save('./upload/qrcode/code_img'.$user_id.$my_user['status'].".png");
$image = \think\Image::open(ROOT_PATH."public/bg2.png");
$image->water(ROOT_PATH."public/upload/qrcode/code_img".$user_id.$my_user['status'].".png",[410,1015],100)
// ->water(ROOT_PATH."public/bg2.png",\think\Image::WATER_CENTER,100)
->save('./upload/poster/poster_'.$user_id.".png");
}else{
//业务员
//保存头像
$avatar=$this->getImage($user['avatar'],'avatar_'.$user['id']);
if($avatar['code']==1){
$this->error($avatar['msg']);
}
$savePath = './upload/poster';
if(!file_exists($savePath)){
mkdir ($savePath,0777,true);
}
$image = \think\Image::open(ROOT_PATH."public/upload/avatar/avatar_".$user_id.".jpeg");
$image->thumb(173,173,\think\Image::THUMB_FIXED)->save('./upload/avatar/avatar_'.$user_id.".png");
$image = \think\Image::open(ROOT_PATH."public/upload/qrcode/code_img".$user_id.$my_user['status'].".png");
... ... @@ -63,21 +73,23 @@ class ShareController extends WeChatBaseController
->water(ROOT_PATH."public/upload/avatar/avatar_".$user_id.".png",[289,478],100)
->water(ROOT_PATH."public/bg.png",\think\Image::WATER_CENTER,100)
->save('./upload/poster/poster_'.$user_id.".png");
}
// }
$share_image = cmf_get_image_url('poster/poster_'.$user_id.".png");
$this->assign('share_image',$share_image);
//分享
$options = config('wechat_config');
$app = new Application($options);
$js = $app->js;
$jssdk = $js->config(array('onMenuShareAppMessage', 'onMenuShareTimeline','onMenuShareQQ'), false, false, true);
$this->assign('jssdk',$jssdk);
// $options = config('wechat_config');
// $app = new Application($options);
// $js = $app->js;
// $jssdk = $js->config(array('onMenuShareAppMessage', 'onMenuShareTimeline','onMenuShareQQ'), false, false, true);
$this->assign('jssdk','$jssdk');
//分享内容
$share_url = url('to_user',array('user_id'=>$user_id),false,true);
$share['share_title'] = "$user[user_nickname]的海报";
$share['share_desc'] = '快来加入我的团队';
$share['share_image'] = $share_image;
$share['share_url'] = $share_url;
$this->assign('status',$my_user['status']);
$this->assign('share',$share);
return $this->fetch();
}
... ...
... ... @@ -37,7 +37,7 @@
</a>
<p style="color:white">我的推广</p>
</div>
<div class="code_Box" style="background: #FE3A00;">
<div class="code_Box" style="<if condition='$status eq 1'>background-color: #FE3A00<else />background-color: #fff</if>">
<img src="{:cmf_get_image_url($share_image)}" style="-webkit-background-size: 100%;background-size: 100%;height: auto;width: 100%;"/>
</div>
<script src="__TMPL__/public/assets/js/base.js"></script>
... ...