...
|
...
|
@@ -10,6 +10,7 @@ namespace app\portal\controller; |
|
|
|
|
|
|
|
|
use cmf\controller\WeChatBaseController;
|
|
|
use EasyWeChat\Foundation\Application;
|
|
|
use think\Db;
|
|
|
|
|
|
class ShareController extends WeChatBaseController
|
...
|
...
|
@@ -65,6 +66,62 @@ class ShareController extends WeChatBaseController |
|
|
// }
|
|
|
$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);
|
|
|
//分享内容
|
|
|
$share_url = url('to_user',array('user_id'=>$user_id),false,true);
|
|
|
$share['share_title'] = 'title';
|
|
|
$share['share_desc'] = 'desc';
|
|
|
$share['share_image'] = $share_image;
|
|
|
$share['share_url'] = $share_url;
|
|
|
$this->assign('share',$share);
|
|
|
return $this->fetch();
|
|
|
}
|
|
|
public function to_user(){
|
|
|
$user_id = $this->request->param('user_id',0,'intval');
|
|
|
if(empty($user_id)){
|
|
|
$this->error('缺少必要参数');
|
|
|
}
|
|
|
$my_user = Db::name('my_user')->where('uid',$user_id)->find();
|
|
|
$user = Db::name('user')->where('id',$user_id)->find();
|
|
|
if(empty($my_user)){
|
|
|
$this->error('查询为空','','','');
|
|
|
}
|
|
|
if($my_user['is_pro'] != 1){
|
|
|
$this->error('无权限','','','');
|
|
|
}
|
|
|
$url = $this->get_url($my_user['id'],$my_user['status']);
|
|
|
$webPath = 'qrcode/share_'.$user_id.'.png';
|
|
|
$savePath = './upload/'.$webPath;
|
|
|
//生成带参二维码
|
|
|
if(!file_exists($savePath)){
|
|
|
$prcode_url = $this->get_code($user_id,$url);
|
|
|
}
|
|
|
//保存头像
|
|
|
$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/share_".$user_id.".png");
|
|
|
$image->thumb(360,360,\think\Image::THUMB_FIXED)->save('./upload/qrcode/share_'.$user_id.".png");
|
|
|
$image = \think\Image::open(ROOT_PATH."public/white.png");
|
|
|
$image->water(ROOT_PATH."public/upload/qrcode/share_".$user_id.".png",[195,725],100)
|
|
|
->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);
|
|
|
return $this->fetch();
|
|
|
}
|
|
|
public function information(){
|
...
|
...
|
|