调整提现申请

This commit is contained in:
luofei 2023-06-13 16:37:21 +08:00
parent f68b344e6e
commit e95bf1e6e7

View File

@ -264,19 +264,34 @@ class Merchant extends BaseController
'financial_bank_name' => $merchant->financial_bank->name ?? '',//银行卡信息
'financial_bank_bank' => $merchant->financial_bank->bank ?? '',//银行卡信息
'financial_bank_code' => $merchant->financial_bank->bank_code ?? '',//银行卡信息
'financial_bank_branch' => $merchant->financial_bank->bank_branch ?? '',//开户行
'financial_type' => $merchant->financial_type,//提现方式
];
return app('json')->success($data);
}
/**
* 提交提现申请
* @param $merId
* @return mixed
* @throws \FormBuilder\exception\FormBuilderException
*/
public function createApply($merId)
{
$data = $this->request->param(['extract_money','financial_type']);
$data = $this->request->param(['extract_money','financial_type', 'financial_bank_name', 'financial_bank_bank', 'financial_bank_code', 'financial_bank_branch']);
$merchant = app()->make(MerchantRepository::class)->search(['mer_id' => $merId])->field('reg_admin_id,uid,mer_id,mer_name,mer_money,financial_bank,financial_wechat,financial_alipay,financial_type')->find();
if ($this->userInfo['uid'] != $merchant->uid){
return app('json')->fail('你不是管理员无法进行提现操作');
}
$bankInfo = [
'name' => $data['financial_bank_name'],
'bank' => $data['financial_bank_bank'],
'bank_code' => $data['financial_bank_code'],
'bank_branch' => $data['financial_bank_branch'],
];
$merchant->update(['financial_bank' => json_encode($bankInfo, JSON_UNESCAPED_UNICODE)], ['mer_id' => $merId]);
$data['mer_admin_id'] = $merchant['reg_admin_id'];
unset($data['financial_bank_name'], $data['financial_bank_bank'], $data['financial_bank_code'], $data['financial_bank_branch']);
app()->make(FinancialRepository::class)->saveApply($merId,$data);
return app('json')->success('申请成功');
}