139 lines
2.9 KiB
PHP
139 lines
2.9 KiB
PHP
<?php
|
|
|
|
namespace app\admin\validate\withdraw;
|
|
|
|
|
|
use app\common\model\merchant\MerchantBank;
|
|
use app\common\validate\BaseValidate;
|
|
|
|
|
|
/**
|
|
* 商户供应商提现表验证器
|
|
* Class MerchantWithdrawValidate
|
|
* @package app\admin\validate\withdraw
|
|
*/
|
|
class MerchantWithdrawValidate extends BaseValidate
|
|
{
|
|
|
|
/**
|
|
* 设置校验规则
|
|
* @var string[]
|
|
*/
|
|
protected $rule = [
|
|
'id' => 'require',
|
|
'mer_id' => 'require',
|
|
'supplier_id' => 'require',
|
|
'merchant_bank_id' => 'require|checkMerchantBank',
|
|
'amount' => 'require|float|gt:0',
|
|
'is_check' => 'require|in:1,2',
|
|
'fail_msg' => 'requireIf:is_check,2',
|
|
'arrival_proof' => 'require|checkArrivalProof'
|
|
];
|
|
|
|
|
|
/**
|
|
* 参数描述
|
|
* @var string[]
|
|
*/
|
|
protected $field = [
|
|
'id' => 'id',
|
|
'mer_id' => '商户id',
|
|
'supplier_id' => '供应商id',
|
|
'merchant_bank_id' => '提现账户id',
|
|
'amount' => '提现金额',
|
|
'is_check' => '审核状态',
|
|
'fail_msg' => '审核不通过原因',
|
|
];
|
|
|
|
|
|
/**
|
|
* @notes 添加场景
|
|
* @return MerchantWithdrawValidate
|
|
* @author likeadmin
|
|
* @date 2024/05/14 11:21
|
|
*/
|
|
public function sceneAdd()
|
|
{
|
|
return $this->only(['mer_id','supplier_id','merchant_bank_id','amount']);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 编辑场景
|
|
* @return MerchantWithdrawValidate
|
|
* @author likeadmin
|
|
* @date 2024/05/14 11:21
|
|
*/
|
|
public function sceneEdit()
|
|
{
|
|
return $this->only(['id','mer_id','supplier_id','merchant_bank_id','amount']);
|
|
}
|
|
|
|
/**
|
|
* @notes 审核场景
|
|
* @return MerchantWithdrawValidate
|
|
* @author likeadmin
|
|
* @date 2024/05/14 11:21
|
|
*/
|
|
public function sceneCheck()
|
|
{
|
|
return $this->only(['id','is_check','fail_msg']);
|
|
}
|
|
|
|
/**
|
|
* @notes 设置到账场景
|
|
* @return MerchantWithdrawValidate
|
|
* @author likeadmin
|
|
* @date 2024/05/14 11:21
|
|
*/
|
|
public function sceneArrival()
|
|
{
|
|
return $this->only(['id','arrival_proof']);
|
|
}
|
|
|
|
public function sceneWithdraw()
|
|
{
|
|
return $this->only(['merchant_bank_id','amount']);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 删除场景
|
|
* @return MerchantWithdrawValidate
|
|
* @author likeadmin
|
|
* @date 2024/05/14 11:21
|
|
*/
|
|
public function sceneDelete()
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 详情场景
|
|
* @return MerchantWithdrawValidate
|
|
* @author likeadmin
|
|
* @date 2024/05/14 11:21
|
|
*/
|
|
public function sceneDetail()
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
|
|
public function checkMerchantBank($value){
|
|
$data = MerchantBank::where('id',$value)->where('is_check',1)->findOrEmpty();
|
|
if($data->isEmpty()){
|
|
return '提现账户信息错误';
|
|
}else{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public function checkArrivalProof($value){
|
|
if(empty($value) || !is_array($value)){
|
|
return '到账凭据数据格式错误';
|
|
}
|
|
return true;
|
|
}
|
|
|
|
} |