ShareSubjectVip.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace App\Http\Requests\QuestionBank\QuestionReception;
  3. use App\Http\Requests\BaseRequest;
  4. /**
  5. * 科目VIP接口验证
  6. * @author 唐远望
  7. * @version 1.0
  8. * @date 2025-05-24
  9. *
  10. */
  11. class ShareSubjectVip extends BaseRequest
  12. {
  13. /**
  14. * 获取应用于请求的规则
  15. *
  16. * @return array
  17. */
  18. public function rules()
  19. {
  20. // 返回结果
  21. return [
  22. 'name' => 'required',
  23. 'id' => 'required|integer|gt:0',
  24. 'status' => 'required|integer|in:0,1',
  25. 'page' => 'integer|min:1',
  26. 'limit' => 'integer|min:1',
  27. 'subject_id' => 'required|integer|gt:0',
  28. ];
  29. }
  30. // 场景列表
  31. protected $scenes = [
  32. 'detail' => ['subject_id'],
  33. 'info' => ['subject_id'],
  34. 'list' => ['page', 'limit'],
  35. 'add' => ['order_id', 'vip_start_time', 'vip_end_time', 'subject_id'],
  36. 'edit' => ['id', 'order_id', 'vip_start_time', 'vip_end_time', 'subject_id'],
  37. 'set_status' => ['id', 'status'],
  38. 'delete' => ['id'],
  39. 'unlock_subject_vip' => ['subject_id'],
  40. ];
  41. /**
  42. * 获取已定义验证规则的错误消息
  43. *
  44. * @return array
  45. */
  46. public function messages()
  47. {
  48. return [
  49. 'name.required' => '名称必填',
  50. 'id.required' => 'ID未知',
  51. 'id.integer' => 'ID格式错误',
  52. 'id.gt' => 'ID格式错误',
  53. 'status.required' => '状态未知',
  54. 'status.integer' => '状态格式错误',
  55. 'status.in' => '状态格式错误',
  56. 'page.integer' => '页码格式错误',
  57. 'page.min' => '页码格式错误',
  58. 'limit.integer' => '每页数量格式错误',
  59. 'limit.min' => '每页数量格式错误',
  60. 'subject_id.required' => '科目ID未知',
  61. 'subject_id.integer' => '科目ID格式错误',
  62. 'subject_id.gt' => '科目ID格式错误',
  63. 'order_id.required' => '订单ID未知',
  64. 'order_id.integer' => '订单ID格式错误',
  65. 'order_id.gt' => '订单ID格式错误',
  66. 'vip_start_time.required' => 'VIP开始时间未知',
  67. 'vip_start_time.date_format' => 'VIP开始时间格式错误',
  68. 'vip_end_time.required' => 'VIP结束时间未知',
  69. 'vip_end_time.date_format' => 'VIP结束时间格式错误',
  70. ];
  71. }
  72. }