Showing
7 changed files
with
30 additions
and
4 deletions
| ... | @@ -3,6 +3,7 @@ | ... | @@ -3,6 +3,7 @@ |
| 3 | namespace App\Http\Controllers; | 3 | namespace App\Http\Controllers; |
| 4 | use Illuminate\Http\Request; | 4 | use Illuminate\Http\Request; |
| 5 | use Carbon\Carbon; | 5 | use Carbon\Carbon; |
| 6 | +use Exception; | ||
| 6 | use Illuminate\Support\Facades\Storage; | 7 | use Illuminate\Support\Facades\Storage; |
| 7 | use Illuminate\Support\Facades\Log; | 8 | use Illuminate\Support\Facades\Log; |
| 8 | 9 | ... | ... |
| ... | @@ -10,7 +10,8 @@ | ... | @@ -10,7 +10,8 @@ |
| 10 | "guzzlehttp/guzzle": "^7.2", | 10 | "guzzlehttp/guzzle": "^7.2", |
| 11 | "laravel/framework": "^9.0", | 11 | "laravel/framework": "^9.0", |
| 12 | "laravel/sanctum": "^2.14", | 12 | "laravel/sanctum": "^2.14", |
| 13 | - "laravel/tinker": "^2.7" | 13 | + "laravel/tinker": "^2.7", |
| 14 | + "league/flysystem-sftp-v3": "^3.33" | ||
| 14 | }, | 15 | }, |
| 15 | "require-dev": { | 16 | "require-dev": { |
| 16 | "fakerphp/faker": "^1.9.1", | 17 | "fakerphp/faker": "^1.9.1", | ... | ... |
This diff is collapsed.
Click to expand it.
| ... | @@ -57,7 +57,16 @@ | ... | @@ -57,7 +57,16 @@ |
| 57 | 'driver' => 'local', | 57 | 'driver' => 'local', |
| 58 | 'root' => storage_path('ocr'), | 58 | 'root' => storage_path('ocr'), |
| 59 | ], | 59 | ], |
| 60 | - | 60 | + 'ocr_results_sftp' => [ |
| 61 | + 'driver' => 'sftp', | ||
| 62 | + 'host' => env('OCR_HOST','172.30.4.104'), | ||
| 63 | + 'username' => env('OCR_USERNAME','ubuntu'), | ||
| 64 | + 'port' => 22, | ||
| 65 | + 'root' => env('OCR_ROOT', '/home/ubuntu/iwa'), | ||
| 66 | + 'timeout' => 30, | ||
| 67 | + 'privateKey' => env('OCR_KEY'), | ||
| 68 | + 'passphrase' => env('OCR_PASSPHRASE', null), | ||
| 69 | + ], | ||
| 61 | ], | 70 | ], |
| 62 | 71 | ||
| 63 | /* | 72 | /* | ... | ... |
| ... | @@ -17,7 +17,7 @@ | ... | @@ -17,7 +17,7 @@ |
| 17 | | | 17 | | |
| 18 | */ | 18 | */ |
| 19 | 19 | ||
| 20 | - 'default' => env('LOG_CHANNEL', 'stack'), | 20 | + 'default' => env('LOG_CHANNEL', 'daily'), |
| 21 | 21 | ||
| 22 | /* | 22 | /* |
| 23 | |-------------------------------------------------------------------------- | 23 | |-------------------------------------------------------------------------- | ... | ... |
| ... | @@ -46,7 +46,7 @@ | ... | @@ -46,7 +46,7 @@ |
| 46 | if(!file) return; | 46 | if(!file) return; |
| 47 | 47 | ||
| 48 | let formData = new FormData(); | 48 | let formData = new FormData(); |
| 49 | - formData.append('file', file); | 49 | + formData.append('attached_file', file); |
| 50 | 50 | ||
| 51 | axios.post("{{route('import_pdf')}}", formData, { | 51 | axios.post("{{route('import_pdf')}}", formData, { |
| 52 | headers:{ | 52 | headers:{ | ... | ... |
| ... | @@ -15,4 +15,19 @@ | ... | @@ -15,4 +15,19 @@ |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | Route::get('/', [OcrController::class,'index']); | 17 | Route::get('/', [OcrController::class,'index']); |
| 18 | +Route::get('/test', function () { | ||
| 19 | + $file = 'D:\\key\\id_rsa_oms_base_test.pem'; | ||
| 20 | + | ||
| 21 | + return response()->json([ | ||
| 22 | + 'php_sapi' => PHP_SAPI, | ||
| 23 | + 'current_user' => get_current_user(), | ||
| 24 | + 'script_owner' => getmyuid(), | ||
| 25 | + 'cwd' => getcwd(), | ||
| 26 | + 'file_exists' => file_exists($file), | ||
| 27 | + 'is_readable' => is_readable($file), | ||
| 28 | + 'realpath' => realpath($file), | ||
| 29 | + 'file_get_contents'=> @file_get_contents($file) !== false ? 'OK' : error_get_last(), | ||
| 30 | + ]); | ||
| 31 | +}); | ||
| 32 | + | ||
| 18 | Route::post('/import-pdf', [OcrController::class,'import_pdf'])->name('import_pdf'); | 33 | Route::post('/import-pdf', [OcrController::class,'import_pdf'])->name('import_pdf'); | ... | ... |
-
Please register or sign in to post a comment