作者 macbook

1

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