file.php 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. use think\facade\Route;
  12. /**
  13. * 附件相关路由
  14. */
  15. Route::group('file', function () {
  16. //附件列表
  17. Route::get('file', 'v1.file.SystemAttachment/index')->option(['real_name' => '图片附件列表']);
  18. //删除图片和数据记录
  19. Route::post('file/delete', 'v1.file.SystemAttachment/delete')->option(['real_name' => '删除图片']);
  20. //移动图片分来表单
  21. Route::get('file/move', 'v1.file.SystemAttachment/move')->option(['real_name' => '移动图片分类表单']);
  22. //移动图片分类
  23. Route::put('file/do_move', 'v1.file.SystemAttachment/moveImageCate')->option(['real_name' => '移动图片分类']);
  24. //修改图片名称
  25. Route::put('file/update/:id', 'v1.file.SystemAttachment/update')->option(['real_name' => '修改图片名称']);
  26. //上传图片
  27. Route::post('upload/[:upload_type]', 'v1.file.SystemAttachment/upload')->option(['real_name' => '上传图片']);
  28. //附件分类管理资源路由
  29. Route::resource('category', 'v1.file.SystemAttachmentCategory')->except(['read'])->option([
  30. 'real_name' => [
  31. 'index' => '获取附件分类管理列表',
  32. 'create' => '获取附件分类管理表单',
  33. 'save' => '保存附件分类管理',
  34. 'edit' => '获取修改附件分类管理表单',
  35. 'update' => '修改附件分类管理',
  36. 'delete' => '删除附件分类管理'
  37. ],
  38. ]);
  39. //获取上传类型
  40. Route::get('upload_type', 'v1.file.SystemAttachment/uploadType')->option(['real_name' => '上传类型']);
  41. //分片上传本地视频
  42. Route::post('video_upload', 'v1.file.SystemAttachment/videoUpload')->option(['real_name' => '分片上传本地视频']);
  43. //获取扫码上传页面链接以及参数
  44. Route::get('scan_upload/qrcode', 'v1.file.SystemAttachment/scanUploadQrcode')->option(['real_name' => '扫码上传页面链接']);
  45. //删除扫码上传token
  46. Route::delete('scan_upload/qrcode', 'v1.file.SystemAttachment/removeUploadQrcode')->option(['real_name' => '删除扫码上传页面链接']);
  47. //获取扫码上传的图片数据
  48. Route::get('scan_upload/image/:scan_token', 'v1.file.SystemAttachment/scanUploadImage')->option(['real_name' => '获取扫码上传的图片数据']);
  49. //网络图片上传
  50. Route::post('online_upload', 'v1.file.SystemAttachment/onlineUpload')->option(['real_name' => '网络图片上传']);
  51. })->middleware([
  52. \app\http\middleware\AllowOriginMiddleware::class,
  53. \app\adminapi\middleware\AdminAuthTokenMiddleware::class,
  54. \app\adminapi\middleware\AdminCheckRoleMiddleware::class,
  55. \app\adminapi\middleware\AdminLogMiddleware::class
  56. ])->option(['mark' => 'file', 'mark_name' => '素材管理']);