RealData.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. namespace App\Http\Requests\ReportStatistics\Backend;
  3. use App\Http\Requests\BaseRequest;
  4. /**
  5. * 实时数据
  6. * @author 唐远望
  7. * @version 1.0
  8. * @date 2025-07-22
  9. *
  10. */
  11. class RealData 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,2,3',
  25. 'page' => 'integer|min:1',
  26. 'limit' => 'integer|min:1',
  27. 'company_id' => 'required|integer|gt:0',
  28. 'user_id' => 'required|integer|gt:0',
  29. 'start_time' => 'date|before_or_equal:end_time',
  30. 'end_time' => 'date|after_or_equal:start_time',
  31. ];
  32. }
  33. // 场景列表
  34. protected $scenes = [
  35. 'detail' => [],
  36. 'list' => ['page', 'limit'],
  37. 'add' => ['company_id', 'user_id'],
  38. 'delete' => ['id'],
  39. 'edit' => [],
  40. 'todayTrend' =>['start_time','end_time']
  41. ];
  42. /**
  43. * 获取已定义验证规则的错误消息
  44. *
  45. * @return array
  46. */
  47. public function messages()
  48. {
  49. return [
  50. 'name.required' => '名称必填',
  51. 'id.required' => 'ID未知',
  52. 'id.integer' => 'ID格式错误',
  53. 'id.gt' => 'ID格式错误',
  54. 'status.required' => '状态未知',
  55. 'status.integer' => '状态格式错误',
  56. 'status.in' => '状态格式错误',
  57. 'page.integer' => '页码格式错误',
  58. 'page.min' => '页码格式错误',
  59. 'limit.integer' => '每页数量格式错误',
  60. 'limit.min' => '每页数量格式错误',
  61. 'company_id.required' => '公司ID未知',
  62. 'company_id.integer' => '公司ID格式错误',
  63. 'company_id.gt' => '公司ID格式错误',
  64. 'user_id.required' => '用户ID未知',
  65. 'user_id.integer' => '用户ID格式错误',
  66. 'user_id.gt' => '用户ID格式错误',
  67. 'start_time.date' => '开始时间格式错误',
  68. 'start_time.before_or_equal' => '开始时间格式错误',
  69. 'end_time.date' => '结束时间格式错误',
  70. 'end_time.after_or_equal' => '结束时间格式错误',
  71. ];
  72. }
  73. }