device.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | Web Routes
  5. |--------------------------------------------------------------------------
  6. |
  7. | Here is where you can register web routes for your application. These
  8. | routes are loaded by the RouteServiceProvider within a group which
  9. | contains the "web" middleware group. Now create something great!
  10. |
  11. */
  12. //心跳
  13. Route::any('/request/heartbeat', 'Api\DeviceController@heartbeat');
  14. //上传名单回调
  15. Route::any('/request/addperson', 'Api\DeviceController@addperson');
  16. //获取人脸图片地址
  17. Route::any('/capture', 'Api\DeviceController@capture');
  18. Route::get('/image/{filename}', function ($filename) {
  19. $path = storage_path('app/public/' . $filename);
  20. $path = $path.'.jpg';
  21. if (!File::exists($path)) {
  22. abort(404);
  23. }
  24. $file = File::get($path);
  25. $type = File::mimeType($path);
  26. return response($file, 200)->header('Content-Type', $type);
  27. });
  28. //获取考勤的图片
  29. Route::get('/kq/image/{filename}', function ($filename) {
  30. $last_dir = explode('_',$filename)[0];
  31. $path = storage_path('app/kq/'.date('Ymd',$last_dir).'/' . $filename);
  32. $path = $path.'.jpg';
  33. if (!File::exists($path)) {
  34. abort(404);
  35. }
  36. $file = File::get($path);
  37. $type = File::mimeType($path);
  38. return response($file, 200)->header('Content-Type', $type);
  39. });