UserControllerValidate.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. namespace App\Http\Validate\User;
  3. use App\Http\Validate\BaseValidate;
  4. use Illuminate\Support\Facades\Validator;
  5. class UserControllerValidate extends BaseValidate
  6. {
  7. /**
  8. * 粉丝列表参数校验
  9. * @param $data
  10. */
  11. public function getFansList($data)
  12. {
  13. $validate = Validator::make($data,
  14. [
  15. "page"=>"required|integer",
  16. "page_size"=>"required|integer",
  17. "type"=>"required:in:1,2"
  18. ]
  19. );
  20. if($validate->fails()){
  21. //验证错误
  22. $this->setError($validate->errors()->first());
  23. return false;
  24. }
  25. return true;
  26. }
  27. /**
  28. * 收汁明细参数校验
  29. * @param $data
  30. */
  31. public function getFinanceList($data)
  32. {
  33. $validate = Validator::make($data,
  34. [
  35. "page"=>"required|integer",
  36. "page_size"=>"required|integer",
  37. "finance_type"=>"required|in:0,1,2"
  38. ]
  39. );
  40. if($validate->fails()){
  41. //验证错误
  42. $this->setError($validate->errors()->first());
  43. return false;
  44. }
  45. return true;
  46. }
  47. /**
  48. * 流水详情参数校验
  49. * @param $data
  50. */
  51. public function getFinanceDetail($data)
  52. {
  53. $validate = Validator::make($data,
  54. [
  55. "id"=>"required|integer",
  56. ]
  57. );
  58. if($validate->fails()){
  59. //验证错误
  60. $this->setError($validate->errors()->first());
  61. return false;
  62. }
  63. return true;
  64. }
  65. /**
  66. * 提现参数校验
  67. * @param $data
  68. */
  69. public function getCash($data)
  70. {
  71. $validate = Validator::make($data,
  72. [
  73. "amount"=>"required",
  74. ]
  75. );
  76. if($validate->fails()){
  77. //验证错误
  78. $this->setError($validate->errors()->first());
  79. return false;
  80. }
  81. return true;
  82. }
  83. /**
  84. * 获取推广二维码参数校验
  85. * @param $data
  86. */
  87. public function getRecommendUrl($data)
  88. {
  89. $validate = Validator::make($data,
  90. [
  91. "code"=>"required",
  92. ]
  93. );
  94. if($validate->fails()){
  95. //验证错误
  96. $this->setError($validate->errors()->first());
  97. return false;
  98. }
  99. return true;
  100. }
  101. }