FileValidate.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\adminapi\validate;
  15. use app\common\validate\BaseValidate;
  16. /**
  17. * 文件验证
  18. * Class FileValidate
  19. * @package app\adminapi\validate
  20. */
  21. class FileValidate extends BaseValidate
  22. {
  23. protected $rule = [
  24. 'id' => 'require|number',
  25. 'cid' => 'require|number',
  26. 'ids' => 'require|array',
  27. 'type' => 'require|in:10,20,30',
  28. 'pid' => 'require|number',
  29. 'name' => 'require|max:20'
  30. ];
  31. protected $message = [
  32. 'id.require' => '缺少id参数',
  33. 'cid.require' => '缺少cid参数',
  34. 'ids.require' => '缺少ids参数',
  35. 'type.require' => '缺少type参数',
  36. 'pid.require' => '缺少pid参数',
  37. 'name.require' => '请填写分组名称',
  38. 'name.max' => '分组名称长度须为20字符内',
  39. ];
  40. /**
  41. * @notes id验证场景
  42. * @return FileValidate
  43. * @author 段誉
  44. * @date 2021/12/29 14:32
  45. */
  46. public function sceneId()
  47. {
  48. return $this->only(['id']);
  49. }
  50. /**
  51. * @notes 重命名文件场景
  52. * @return FileValidate
  53. * @author 段誉
  54. * @date 2021/12/29 14:32
  55. */
  56. public function sceneRename()
  57. {
  58. return $this->only(['id', 'name']);
  59. }
  60. /**
  61. * @notes 新增分类场景
  62. * @return FileValidate
  63. * @author 段誉
  64. * @date 2021/12/29 14:33
  65. */
  66. public function sceneAddCate()
  67. {
  68. return $this->only(['type', 'pid', 'name']);
  69. }
  70. /**
  71. * @notes 编辑分类场景
  72. * @return FileValidate
  73. * @author 段誉
  74. * @date 2021/12/29 14:33
  75. */
  76. public function sceneEditCate()
  77. {
  78. return $this->only(['id', 'name']);
  79. }
  80. /**
  81. * @notes 移动场景
  82. * @return FileValidate
  83. * @author 段誉
  84. * @date 2021/12/29 14:33
  85. */
  86. public function sceneMove()
  87. {
  88. return $this->only(['ids', 'cid']);
  89. }
  90. /**
  91. * @notes 删除场景
  92. * @return FileValidate
  93. * @author 段誉
  94. * @date 2021/12/29 14:35
  95. */
  96. public function sceneDelete()
  97. {
  98. return $this->only(['ids']);
  99. }
  100. }