EarningsRecord.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace App\Http\Requests\Api\Promoter;
  3. use App\Http\Requests\BaseRequest;
  4. use Illuminate\Validation\Rule;
  5. /**
  6. * 推广员推广收益记录接口验证
  7. * @author 唐远望
  8. * @version 1.0
  9. * @date 2025-09-15
  10. *
  11. */
  12. class EarningsRecord extends BaseRequest
  13. {
  14. /**
  15. * 获取应用于请求的规则
  16. *
  17. * @return array
  18. */
  19. public function rules()
  20. {
  21. // 返回结果
  22. $rules = [
  23. 'name' => 'required',
  24. 'id' => 'required|integer|gt:0',
  25. 'page' => 'integer|min:1',
  26. 'limit' => 'integer|min:1',
  27. 'status ' => 'integer|in:0,1',
  28. 'promoter_userid' => 'required|integer|gt:0',
  29. ];
  30. return $rules;
  31. }
  32. // 场景列表
  33. protected $scenes = [
  34. 'add' => [],
  35. 'list' => ['page', 'limit'],
  36. 'detail' => ['id'],
  37. 'set_status' => ['id', 'status'],
  38. ];
  39. /**
  40. * 获取已定义验证规则的错误消息
  41. *
  42. * @return array
  43. */
  44. public function messages()
  45. {
  46. return [
  47. 'name.required' => '名称必填',
  48. 'id.required' => 'ID未知',
  49. 'id.integer' => 'ID格式错误',
  50. 'id.gt' => 'ID格式错误',
  51. 'status.required' => '状态未知',
  52. 'status.integer' => '状态格式错误',
  53. 'status.in' => '状态格式错误',
  54. 'page.integer' => '页码格式错误',
  55. 'page.min' => '页码格式错误',
  56. 'limit.integer' => '每页数量格式错误',
  57. 'limit.min' => '每页数量格式错误',
  58. 'promoter_userid.required' => '推广员ID未知',
  59. 'promoter_userid.integer' => '推广员ID格式错误',
  60. 'promoter_userid.gt' => '推广员ID格式错误',
  61. ];
  62. }
  63. }