新增获取提现数据接口
This commit is contained in:
parent
695cb4f1a2
commit
ac529a570f
@ -32,7 +32,10 @@ class DoctorAccountService extends BaseService
|
||||
}
|
||||
|
||||
// 获取医生月度余额
|
||||
$amount_total_month = $this->getDoctorMonthAmountTotal($user_info['client_user_id'],$date);;
|
||||
$amount_total_month = $this->getDoctorMonthAmountTotal($user_info['client_user_id'], $date);
|
||||
if ($amount_total_month > 0) {
|
||||
$amount_total_month = $amount_total_month * 0.75;
|
||||
}
|
||||
|
||||
// 获取医生月度已提现金额-审核通过时间为准
|
||||
$params = array();
|
||||
@ -129,9 +132,12 @@ class DoctorAccountService extends BaseService
|
||||
return success($order_inquiry);
|
||||
}
|
||||
|
||||
// 获取提现数据
|
||||
public function getDoctorWithdrawal(){
|
||||
|
||||
/**
|
||||
* 获取提现数据
|
||||
* @return array
|
||||
*/
|
||||
public function getDoctorWithdrawal(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
// 获取医生信息
|
||||
@ -178,13 +184,20 @@ class DoctorAccountService extends BaseService
|
||||
$result['bank_card_code_mask'] = $doctor_bank_card['bank_card_code_mask'];
|
||||
|
||||
|
||||
|
||||
// 获取医生账户余额
|
||||
$balance_account = $this->getDoctorBalanceAccount($user_info['client_user_id']);
|
||||
if ($balance_account > 0) {
|
||||
$balance_account = $balance_account * 0.75;
|
||||
}
|
||||
$result['balance_account'] = floor($balance_account * 100) / 100;
|
||||
|
||||
// 计算医生个人所得税
|
||||
$income_tax = $this->computeIndividualIncomeTax($balance_account);
|
||||
|
||||
$income_tax = floor($income_tax * 100) / 100;
|
||||
$result['income_tax'] = $income_tax;
|
||||
|
||||
return success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -227,14 +240,37 @@ class DoctorAccountService extends BaseService
|
||||
return $total_amount;
|
||||
}
|
||||
|
||||
// 获取医生某月提现数据
|
||||
// 审核通过时间为准
|
||||
public function getDoctorMonthWithdrawalData(){
|
||||
|
||||
/**
|
||||
* 计算个人所得税
|
||||
* @param string|int $income
|
||||
* @return float|int
|
||||
*/
|
||||
protected function computeIndividualIncomeTax(string|int $income): float|int
|
||||
{
|
||||
if ($income <= 800) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 计算个人所得税
|
||||
protected function computeIndividualIncomeTax(){
|
||||
if ($income <= 4000) {
|
||||
$income = $income - 800;
|
||||
}
|
||||
|
||||
// 实际纳税金额
|
||||
$income = $income * 0.8;
|
||||
|
||||
if ($income <= 20000) {
|
||||
$tax_rate = 0.2; // 税率
|
||||
$quick_deduction = 0; // 速算扣除数
|
||||
} elseif ($income <= 50000) {
|
||||
$tax_rate = 0.3;// 税率
|
||||
$quick_deduction = 2000; // 速算扣除数
|
||||
} else {
|
||||
$tax_rate = 0.4;
|
||||
$quick_deduction = 7000; // 速算扣除数
|
||||
}
|
||||
|
||||
$income_tax = $income * $tax_rate - $quick_deduction;
|
||||
|
||||
return $income_tax;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user