平台推送pdf图片等 存储122服务器

main
yanzai 5 months ago
parent 78c45d496b
commit 7f5e331655

@ -166,11 +166,13 @@ class HealthCertificateController extends Controller
$filePath = 'health_certificate/photo/' . date('Ymd') . '/' . $fileName;
// 使用本地磁盘写入文件
Storage::disk('public')->put($filePath, $imageData);
// Storage::disk('public')->put($filePath, $imageData);
// 构建访问 URL 或者直接存相对路径
$photoPath = '/storage/' . $filePath;
// $photoPath = '/storage/' . $filePath;
$upUrl= Storage::disk('network_drive')->put('/phpUpload/'.$filePath, $imageData);
$photoPath=Storage::disk('network_drive')->url('/phpUpload/'.$filePath);
// 获取所有数据
$data = $request->except(['photo']);
@ -232,6 +234,7 @@ class HealthCertificateController extends Controller
$file = $request->file('file');
// Storage::disk('network_drive')->put('', $file);
if (!$key || $key !== '5Kj9P1pL0f8e7Vw3I2qX4mT6zJ1OxWcQ') {
return response()->json([
@ -285,11 +288,13 @@ class HealthCertificateController extends Controller
], 400);
}
// 生成唯一文件名
$filename = uniqid() . '_' . mt_rand(0, 999999) . '.' . $file_extension;
$path = $file->store($path, 'public');
$url = '/storage/' . $path ;
// $path = $file->store($path, 'public');
// $url = '/storage/' . $path ;
// dd('/phpUpload/'.$path.'/'.$filename);
$upUrl= Storage::disk('network_drive')->put('/phpUpload/'.$path, $file);
$url=Storage::disk('network_drive')->url($upUrl);
$data=[
'hospitalCode' => $hospitalCode,
'hospitalName' => $hospitalName,

@ -33,6 +33,7 @@ class UpLoadController extends Controller
$image = base64_decode(explode(',', $base64Image)[1]);
$date = date("Ymd");
$filename = 'image_' . time() . '.png'; // 或者使用其他方式生成文件名
Storage::disk('public')->put('/H5Upload/'.$date.'/'.$filename, $image); // 保存图片到 public 目录
return \Yz::Return(true,'上传成功',['fileurl' =>'/storage/H5Upload/'.$date.'/'.$filename]);

@ -52,7 +52,12 @@ return [
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
],
'network_drive' => [
'driver' => 'local',
'root' => 'D:/aa', // Windows 映射的盘符路径
'url' => env('APP_URL').'/phpstorage',
'visibility' => 'public',
],
],
/*

@ -16,6 +16,16 @@ use Illuminate\Support\Facades\Route;
Route::get('/', function () {
return view('welcome');
});
Route::get('/phpstorage/{path}', function ($path) {
// 拼接A服务器的实际路径
$storagePath = 'Z:/' . $path;
if (!file_exists($storagePath)) {
abort(404);
}
// 返回A服务器的图片
return response()->file($storagePath);
})->where('path', '.*');
//微信登录授权获取code
Route::get('/wxLogin/{env}', function ($env) {

Loading…
Cancel
Save