123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <?php
- namespace App\Http\Validate\User;
- use App\Http\Validate\BaseValidate;
- use Illuminate\Support\Facades\Validator;
- class UserControllerValidate extends BaseValidate
- {
- /**
- * 粉丝列表参数校验
- * @param $data
- */
- public function getFansList($data)
- {
- $validate = Validator::make($data,
- [
- "page"=>"required|integer",
- "page_size"=>"required|integer",
- "type"=>"required:in:1,2"
- ]
- );
- if($validate->fails()){
- //验证错误
- $this->setError($validate->errors()->first());
- return false;
- }
- return true;
- }
- /**
- * 收汁明细参数校验
- * @param $data
- */
- public function getFinanceList($data)
- {
- $validate = Validator::make($data,
- [
- "page"=>"required|integer",
- "page_size"=>"required|integer",
- "finance_type"=>"required|in:0,1,2"
- ]
- );
- if($validate->fails()){
- //验证错误
- $this->setError($validate->errors()->first());
- return false;
- }
- return true;
- }
- /**
- * 流水详情参数校验
- * @param $data
- */
- public function getFinanceDetail($data)
- {
- $validate = Validator::make($data,
- [
- "id"=>"required|integer",
- ]
- );
- if($validate->fails()){
- //验证错误
- $this->setError($validate->errors()->first());
- return false;
- }
- return true;
- }
- /**
- * 提现参数校验
- * @param $data
- */
- public function getCash($data)
- {
- $validate = Validator::make($data,
- [
- "amount"=>"required|integer",
- ]
- );
- if($validate->fails()){
- //验证错误
- $this->setError($validate->errors()->first());
- return false;
- }
- if($data["amount"] < 100){
- $this->setError("提现金额不能小于1元");
- return false;
- }
- return true;
- }
- /**
- * 获取推广二维码参数校验
- * @param $data
- */
- public function getRecommendUrl($data)
- {
- $validate = Validator::make($data,
- [
- "code"=>"required",
- ]
- );
- if($validate->fails()){
- //验证错误
- $this->setError($validate->errors()->first());
- return false;
- }
- return true;
- }
- }
|