feat: 支持上传及查看高清原图自定义头像
This commit is contained in:
@@ -40,6 +40,16 @@ class UserController extends Controller
|
||||
$targetUser = User::where('username', $username)->firstOrFail();
|
||||
$operator = Auth::user();
|
||||
|
||||
// 探测原图
|
||||
$headfaceOriginal = $targetUser->headfaceUrl;
|
||||
if (str_starts_with((string) $targetUser->headface, 'storage/')) {
|
||||
$info = pathinfo($targetUser->headface);
|
||||
$origPath = $info['dirname'].'/'.$info['filename'].'_original.'.($info['extension'] ?? 'jpg');
|
||||
if (\Illuminate\Support\Facades\Storage::disk('public')->exists(substr($origPath, 8))) {
|
||||
$headfaceOriginal = '/'.$origPath;
|
||||
}
|
||||
}
|
||||
|
||||
// 基础公开信息
|
||||
$activePosition = $targetUser->activePosition?->load('position.department')->position;
|
||||
$data = [
|
||||
@@ -48,6 +58,7 @@ class UserController extends Controller
|
||||
1 => '男', 2 => '女', default => ''
|
||||
},
|
||||
'headface' => $targetUser->headface,
|
||||
'headface_original' => $headfaceOriginal,
|
||||
'usersf' => $targetUser->usersf,
|
||||
'user_level' => $targetUser->user_level,
|
||||
'qianming' => $targetUser->qianming,
|
||||
|
||||
Reference in New Issue
Block a user