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

海报

@@ -33,27 +33,37 @@ class ShareController extends WeChatBaseController @@ -33,27 +33,37 @@ class ShareController extends WeChatBaseController
33 if($my_user['is_pro'] != 1){ 33 if($my_user['is_pro'] != 1){
34 $this->error('无权限','','',''); 34 $this->error('无权限','','','');
35 } 35 }
36 - /* if(empty($my_user['phone'])){  
37 - $this->redirect('information');  
38 - }*/ 36 + /* if(empty($my_user['phone'])){
  37 + $this->redirect('information');
  38 + }*/
39 //判断有没有生成过 39 //判断有没有生成过
40 // if(!file_exists('./upload/poster/poster_'.$user_id.".png")){ 40 // if(!file_exists('./upload/poster/poster_'.$user_id.".png")){
41 - $url = $this->get_url($my_user['id'],$my_user['status']);  
42 - $webPath = 'qrcode/code_img'.$user_id.$my_user['status'].'.png';  
43 - $savePath = './upload/'.$webPath;  
44 - //生成带参二维码 41 + $url = $this->get_url($my_user['id'],$my_user['status']);
  42 + $webPath = 'qrcode/code_img'.$user_id.$my_user['status'].'.png';
  43 + $savePath = './upload/'.$webPath;
  44 + //生成带参二维码
45 if(!file_exists($savePath)){ 45 if(!file_exists($savePath)){
46 $prcode_url = $this->code_img($my_user['id'],$my_user['status']); 46 $prcode_url = $this->code_img($my_user['id'],$my_user['status']);
47 } 47 }
  48 + $savePath = './upload/poster';
  49 + if(!file_exists($savePath)){
  50 + mkdir ($savePath,0777,true);
  51 + }
  52 + if($my_user['status'] == 3){
  53 + //老师
  54 + $image = \think\Image::open(ROOT_PATH."public/upload/qrcode/code_img".$user_id.$my_user['status'].".png");
  55 + $image->thumb(300,300,\think\Image::THUMB_FIXED)->save('./upload/qrcode/code_img'.$user_id.$my_user['status'].".png");
  56 + $image = \think\Image::open(ROOT_PATH."public/bg2.png");
  57 + $image->water(ROOT_PATH."public/upload/qrcode/code_img".$user_id.$my_user['status'].".png",[410,1015],100)
  58 +// ->water(ROOT_PATH."public/bg2.png",\think\Image::WATER_CENTER,100)
  59 + ->save('./upload/poster/poster_'.$user_id.".png");
  60 + }else{
  61 + //业务员
48 //保存头像 62 //保存头像
49 $avatar=$this->getImage($user['avatar'],'avatar_'.$user['id']); 63 $avatar=$this->getImage($user['avatar'],'avatar_'.$user['id']);
50 if($avatar['code']==1){ 64 if($avatar['code']==1){
51 $this->error($avatar['msg']); 65 $this->error($avatar['msg']);
52 } 66 }
53 - $savePath = './upload/poster';  
54 - if(!file_exists($savePath)){  
55 - mkdir ($savePath,0777,true);  
56 - }  
57 $image = \think\Image::open(ROOT_PATH."public/upload/avatar/avatar_".$user_id.".jpeg"); 67 $image = \think\Image::open(ROOT_PATH."public/upload/avatar/avatar_".$user_id.".jpeg");
58 $image->thumb(173,173,\think\Image::THUMB_FIXED)->save('./upload/avatar/avatar_'.$user_id.".png"); 68 $image->thumb(173,173,\think\Image::THUMB_FIXED)->save('./upload/avatar/avatar_'.$user_id.".png");
59 $image = \think\Image::open(ROOT_PATH."public/upload/qrcode/code_img".$user_id.$my_user['status'].".png"); 69 $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 @@ -63,21 +73,23 @@ class ShareController extends WeChatBaseController
63 ->water(ROOT_PATH."public/upload/avatar/avatar_".$user_id.".png",[289,478],100) 73 ->water(ROOT_PATH."public/upload/avatar/avatar_".$user_id.".png",[289,478],100)
64 ->water(ROOT_PATH."public/bg.png",\think\Image::WATER_CENTER,100) 74 ->water(ROOT_PATH."public/bg.png",\think\Image::WATER_CENTER,100)
65 ->save('./upload/poster/poster_'.$user_id.".png"); 75 ->save('./upload/poster/poster_'.$user_id.".png");
  76 + }
66 // } 77 // }
67 $share_image = cmf_get_image_url('poster/poster_'.$user_id.".png"); 78 $share_image = cmf_get_image_url('poster/poster_'.$user_id.".png");
68 $this->assign('share_image',$share_image); 79 $this->assign('share_image',$share_image);
69 //分享 80 //分享
70 - $options = config('wechat_config');  
71 - $app = new Application($options);  
72 - $js = $app->js;  
73 - $jssdk = $js->config(array('onMenuShareAppMessage', 'onMenuShareTimeline','onMenuShareQQ'), false, false, true);  
74 - $this->assign('jssdk',$jssdk); 81 +// $options = config('wechat_config');
  82 +// $app = new Application($options);
  83 +// $js = $app->js;
  84 +// $jssdk = $js->config(array('onMenuShareAppMessage', 'onMenuShareTimeline','onMenuShareQQ'), false, false, true);
  85 + $this->assign('jssdk','$jssdk');
75 //分享内容 86 //分享内容
76 $share_url = url('to_user',array('user_id'=>$user_id),false,true); 87 $share_url = url('to_user',array('user_id'=>$user_id),false,true);
77 $share['share_title'] = "$user[user_nickname]的海报"; 88 $share['share_title'] = "$user[user_nickname]的海报";
78 $share['share_desc'] = '快来加入我的团队'; 89 $share['share_desc'] = '快来加入我的团队';
79 $share['share_image'] = $share_image; 90 $share['share_image'] = $share_image;
80 $share['share_url'] = $share_url; 91 $share['share_url'] = $share_url;
  92 + $this->assign('status',$my_user['status']);
81 $this->assign('share',$share); 93 $this->assign('share',$share);
82 return $this->fetch(); 94 return $this->fetch();
83 } 95 }
@@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
37 </a> 37 </a>
38 <p style="color:white">我的推广</p> 38 <p style="color:white">我的推广</p>
39 </div> 39 </div>
40 -<div class="code_Box" style="background: #FE3A00;"> 40 +<div class="code_Box" style="<if condition='$status eq 1'>background-color: #FE3A00<else />background-color: #fff</if>">
41 <img src="{:cmf_get_image_url($share_image)}" style="-webkit-background-size: 100%;background-size: 100%;height: auto;width: 100%;"/> 41 <img src="{:cmf_get_image_url($share_image)}" style="-webkit-background-size: 100%;background-size: 100%;height: auto;width: 100%;"/>
42 </div> 42 </div>
43 <script src="__TMPL__/public/assets/js/base.js"></script> 43 <script src="__TMPL__/public/assets/js/base.js"></script>