作者 macbook

1

@@ -596,22 +596,21 @@ class User extends Base @@ -596,22 +596,21 @@ class User extends Base
596 $avatar_url = !empty($user['avatar']) ? cdnurl($user['avatar']) : ''; 596 $avatar_url = !empty($user['avatar']) ? cdnurl($user['avatar']) : '';
597 empty($avatar_url) && $this->error('请先上传头像'); 597 empty($avatar_url) && $this->error('请先上传头像');
598 !url_exists($avatar_url) && $this->error('头像失效,请更新头像'); 598 !url_exists($avatar_url) && $this->error('头像失效,请更新头像');
599 - // // 本地路径 599 + // 本地路径
600 $dir = 'uploads/user'; 600 $dir = 'uploads/user';
601 if (!file_exists($dir)){ 601 if (!file_exists($dir)){
602 mkdir($dir,0777,true); 602 mkdir($dir,0777,true);
603 } 603 }
604 604
605 // 用户小程序码 605 // 用户小程序码
606 - $qrcode = $dir.'/qrcode_'.$user['id'].'.jpg'; 606 + $qrcode = $dir.'/qrcode_'.$user['id'].'.png';
607 if(!file_exists($qrcode)){ 607 if(!file_exists($qrcode)){
608 - $wechat = new Wechat('wxMiniProgram');  
609 - $response = $wechat->getApp()->app_code->getUnlimit($user['id'], [ 608 + $response = new Wechat('wxMiniProgram')->app_code->getUnlimit($user['id'], [
610 'page' => 'pages/vip/vip', 609 'page' => 'pages/vip/vip',
611 'width' => 280, //最小宽度280 610 'width' => 280, //最小宽度280
612 ]); 611 ]);
613 if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) { 612 if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) {
614 - $response->save($qrcode); 613 + $response->saveAs($dir, str_replace($dir.'/','',$qrcode));
615 } 614 }
616 // 280不满足,再缩小 615 // 280不满足,再缩小
617 \think\Image::open($qrcode)->thumb(64,64)->save($qrcode); 616 \think\Image::open($qrcode)->thumb(64,64)->save($qrcode);