修正了发起提现接口金额
This commit is contained in:
parent
e69315bc00
commit
82b11f6e62
@ -200,7 +200,7 @@ class DoctorAccountService extends BaseService
|
||||
$bank['bank_card_name'] = $user_doctor_info['card_name'];
|
||||
$bank['bank_card_name_mask'] = $user_doctor_info['card_name_mask'];
|
||||
|
||||
$balance_account = 0;
|
||||
$amount_total = 0;
|
||||
$order_inquiry_id_array = [];
|
||||
// 获取医生账户余额
|
||||
if (!empty($order_inquiry_ids)){
|
||||
@ -212,7 +212,7 @@ class DoctorAccountService extends BaseService
|
||||
$in_params = explode(',',$order_inquiry_ids);
|
||||
$order_inquiry = OrderInquiry::getInList($params,$in_params);
|
||||
if (!empty($order_inquiry)){
|
||||
$balance_account = array_sum(array_column($order_inquiry->toArray(),'amount_total'));
|
||||
$amount_total = array_sum(array_column($order_inquiry->toArray(),'amount_total'));
|
||||
}
|
||||
|
||||
$order_inquiry_id_array = $in_params;
|
||||
@ -220,19 +220,17 @@ class DoctorAccountService extends BaseService
|
||||
$InquiryService = new InquiryService();
|
||||
$order_inquiry = $InquiryService->getDoctorCanWithdrawalInquiryOrder($user_info['client_user_id']);
|
||||
if (!empty($order_inquiry)){
|
||||
$balance_account = array_sum(array_column($order_inquiry,'amount_total'));
|
||||
$amount_total = array_sum(array_column($order_inquiry,'amount_total'));
|
||||
$order_inquiry_id_array = array_column($order_inquiry,'order_inquiry_id');
|
||||
}
|
||||
}
|
||||
|
||||
if ($balance_account > 0){
|
||||
$balance_account = floor($balance_account * 0.75 * 100) / 100;
|
||||
}
|
||||
$amount_total = $amount_total * 0.75;
|
||||
|
||||
// 计算医生个人所得税
|
||||
$income_tax = $this->computeIndividualIncomeTax($balance_account);
|
||||
$income_tax = $this->computeIndividualIncomeTax($amount_total);
|
||||
|
||||
$withdrawal_amount = floor(($balance_account - $income_tax) * 100) / 100;
|
||||
$withdrawal_amount = floor(($amount_total - $income_tax) * 100) / 100;
|
||||
|
||||
$income_tax = floor($income_tax * 100) / 100;
|
||||
|
||||
@ -386,17 +384,14 @@ class DoctorAccountService extends BaseService
|
||||
$amount_total += $order_inquiry['amount_total'];
|
||||
}
|
||||
|
||||
// 医生分成金额
|
||||
if ($amount_total > 0){
|
||||
$amount_total = floor($amount_total * 0.75 * 100) / 100;
|
||||
}
|
||||
// 提现金额
|
||||
$amount_total = $amount_total * 0.75;
|
||||
|
||||
// 计算医生个人所得税
|
||||
$income_tax = $this->computeIndividualIncomeTax($amount_total);
|
||||
|
||||
// 可提现金额
|
||||
$withdrawal_amount = floor(($amount_total - $income_tax) * 100) / 100;
|
||||
|
||||
$income_tax = floor($income_tax * 100) / 100;
|
||||
// 实际提现金额
|
||||
$withdrawal_amount = $amount_total - $income_tax;
|
||||
|
||||
if ($withdrawal_amount_total != $withdrawal_amount){
|
||||
return fail(HttpEnumCode::SERVER_ERROR,"金额不符合");
|
||||
@ -426,10 +421,16 @@ class DoctorAccountService extends BaseService
|
||||
$data['bank_id'] = $doctor_bank_card['bank_id'];
|
||||
$data['account_name'] = $basic_bank['bank_name'];
|
||||
$data['bank_card_code'] = $doctor_bank_card['bank_card_code'];
|
||||
$data['bank_card_code_four'] = substr($doctor_bank_card['bank_card_code'], -4);;
|
||||
$data['applied_withdrawal_amount'] = $withdrawal_amount + $income_tax; // 提现金额
|
||||
$data['actual_withdrawal_amount'] = $withdrawal_amount; // 实际提现金额
|
||||
$data['income_tax'] = $income_tax; // 提现所得税金额
|
||||
$data['bank_card_code_four'] = substr($doctor_bank_card['bank_card_code'], -4);
|
||||
if ($amount_total > 0){
|
||||
$data['applied_withdrawal_amount'] = floor($amount_total * 100) / 100; // 提现金额
|
||||
}
|
||||
if ($withdrawal_amount > 0){
|
||||
$data['actual_withdrawal_amount'] = floor($withdrawal_amount * 100) / 100; // 实际提现金额
|
||||
}
|
||||
if ($income_tax > 0){
|
||||
$data['income_tax'] = floor($income_tax * 100) / 100; // 提现所得税金额
|
||||
}
|
||||
$data['examine_status'] = 1; // 审核状态(1:审核中 2:审核通过 3:审核未通过)
|
||||
$doctor_withdrawal = DoctorWithdrawal::addDoctorWithdrawal($data);
|
||||
if (empty($doctor_withdrawal)){
|
||||
@ -479,10 +480,16 @@ class DoctorAccountService extends BaseService
|
||||
// 账户表锁定
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
// 账户余额
|
||||
DoctorAccount::dec($params,'balance_account',$amount_total);
|
||||
|
||||
DoctorAccount::inc($params,'applied_withdrawal_amount',$withdrawal_amount);
|
||||
// 提现金额
|
||||
DoctorAccount::inc($params,'applied_withdrawal_amount',$amount_total);
|
||||
|
||||
// 实际提现金额
|
||||
DoctorAccount::inc($params,'actual_withdrawal_amount',$withdrawal_amount);
|
||||
|
||||
// 所得税金额
|
||||
DoctorAccount::inc($params,'income_tax',$income_tax);
|
||||
|
||||
Db::commit();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user