获取提现数据 增加可提现订单号
This commit is contained in:
parent
7004031810
commit
533a02806f
@ -306,6 +306,45 @@ class DoctorAccountService extends BaseService
|
||||
$amount_total = floor($doctor_account['balance_account'] * 100) / 100;
|
||||
}
|
||||
|
||||
// 获取可提现订单列表
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
$params['is_withdrawal'] = 0;
|
||||
|
||||
$orders = Order:: getDoctorWithdrawalOrderList($params, $user_doctor['is_platform_deep_cooperation']);
|
||||
if (empty($orders)){
|
||||
// 无订单,账户余额强制赋0;
|
||||
$amount_total = 0;
|
||||
}
|
||||
|
||||
$OrderService = new OrderService();
|
||||
|
||||
// 可提现金额
|
||||
$expected_amount_total = 0;
|
||||
|
||||
// 订单号数据
|
||||
$order_nos = [];
|
||||
|
||||
foreach ($orders as $order){
|
||||
// 获取订单退款金额
|
||||
$refund_total = $OrderService->getOrderRefundAmount($order['order_no']);
|
||||
|
||||
// 获取订单可提现金额
|
||||
$expected_amount_total = bcadd(
|
||||
$expected_amount_total,
|
||||
$OrderService->getOrderWithdrawalAmount($order,$refund_total),
|
||||
2
|
||||
);
|
||||
|
||||
$order_nos[] = $order['order_no'];
|
||||
}
|
||||
|
||||
// 对比订单金额和账户金额;金额相差1元及以上返回错误
|
||||
$diff_amount_total = abs($amount_total - $expected_amount_total);
|
||||
if ($diff_amount_total >= 1){
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "提现金额错误");
|
||||
}
|
||||
|
||||
/* // 获取可提现订单列表
|
||||
$orders = Order:: getDoctorWithdrawalOrderList($params, $user_doctor['is_platform_deep_cooperation'], ['*']);
|
||||
if (empty($orders)){
|
||||
@ -353,6 +392,7 @@ class DoctorAccountService extends BaseService
|
||||
$result['amount_total'] = $amount_total; // 账户余额
|
||||
$result['withdrawal_amount'] = $withdrawal_amount; // 提现金额
|
||||
$result['income_tax'] = $income_tax; // 个人所得税
|
||||
$result['order_nos'] = $order_nos; // 可提现订单号
|
||||
|
||||
return success($result);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user