34 lines
899 B
PHP
34 lines
899 B
PHP
<?php
|
|
|
|
namespace app\api\validate;
|
|
|
|
use app\common\validate\BaseValidate;
|
|
use think\facade\Db;
|
|
|
|
class MerchantBankValidate extends BaseValidate
|
|
{
|
|
protected $rule = [
|
|
'is_own|账号类型' => 'require|in:0,1',
|
|
'name|姓名' => 'require',
|
|
'bank_id|开户银行' => 'require|checkBank',
|
|
'bank_code|银行账号' => 'require',
|
|
'bank_branch|开户网点' => 'require|max:32',
|
|
'id_card|身份证' => 'requireIf:is_own,0|idCard',
|
|
'phone|手机号' => 'requireIf:is_own,0|mobile',
|
|
// 'financial_img|相关凭证' => 'require'
|
|
];
|
|
|
|
|
|
public function sceneAdd()
|
|
{
|
|
return $this->only(['is_own','bank_id','name','bank_code','bank_branch','id_card','phone','financial_img']);
|
|
}
|
|
|
|
public function checkBank($value){
|
|
$data = Db::name('bank')->where('id',$value)->findOrEmpty();
|
|
if(empty($data)){
|
|
return '开户银行不存在';
|
|
}
|
|
return true;
|
|
}
|
|
} |