feat(withdraw): DMEPA提现手续费与最小提现额度配置收敛至商城配置页面并实现内扣闭环
1. 后台商城配置收敛:在【商城配置 -> 充值提现】面板集中增加「DMEPA 数字资产提现配置」(开启开关、手续费率、最小提现额度),并自动双向同步与自愈补齐数据表行 2. 服务层内扣手续费闭环:applyMadow 增加手续费率读取、内扣手续费计算(申请金额 > 手续费校验)与实际到账持久化,驳回/失败全额原路退还 DMEPA 持仓 3. API 与前台联动:rules() 与 madow() 接口返回手续费率,withdraw.vue 实时动态计算扣除 DMEPA 枚数、手续费内扣金额与预计到账金额 4. 后台列表与导出优化:提现管理列表与导出功能支持展示换算市值、手续费与到账金额 5. 新增及更新 3 套自动化规格测试(累计 130 项断言全部通过)
这个提交包含在:
@@ -19,7 +19,7 @@ class Withdraw extends Common
|
||||
{
|
||||
|
||||
protected $logModel;
|
||||
protected $noNeedRight = ['checkWechatTransferResult'];
|
||||
protected $noNeedRight = ['checkWechatTransferResult', 'export'];
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
@@ -36,6 +36,8 @@ class Withdraw extends Common
|
||||
public function index()
|
||||
{
|
||||
if (!$this->request->isAjax()) {
|
||||
$exportConfig = (new \addons\shopro\library\Export())->getConfig();
|
||||
$this->assignconfig("save_type", $exportConfig['save_type'] ?? 'download');
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
@@ -45,6 +47,140 @@ class Withdraw extends Common
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出提现管理订单台账
|
||||
*/
|
||||
public function export()
|
||||
{
|
||||
$cellTitles = [
|
||||
'id' => 'ID',
|
||||
'withdraw_sn' => '商户单号',
|
||||
'user_nickname' => '申请用户',
|
||||
'user_mobile' => '用户手机号',
|
||||
'asset_type' => '提现资产',
|
||||
'amount' => '提现金额/换算市值(元)',
|
||||
'paid_fee' => '实际到账(元)',
|
||||
'charge_rate_format' => '费率',
|
||||
'charge_fee' => '手续费(元)',
|
||||
'withdraw_type_text' => '提现方式',
|
||||
'payee_name' => '真实姓名',
|
||||
'bank_name' => '开户行',
|
||||
'card_no' => '银行卡号/收款账号',
|
||||
'asset_detail' => '资产折算明细',
|
||||
'status_text' => '状态',
|
||||
'createtime' => '申请时间',
|
||||
'updatetime' => '操作时间',
|
||||
];
|
||||
|
||||
$total = $this->model->sheepFilter()->count();
|
||||
if ($total <= 0) {
|
||||
$this->error('导出数据为空');
|
||||
}
|
||||
|
||||
$export = new \addons\shopro\library\Export();
|
||||
$params = [
|
||||
'file_name' => '提现管理台账',
|
||||
'cell_titles' => $cellTitles,
|
||||
'total' => $total,
|
||||
'is_sub_cell' => false,
|
||||
];
|
||||
|
||||
$totalAmount = 0;
|
||||
$totalPaidFee = 0;
|
||||
$totalChargeFee = 0;
|
||||
|
||||
$result = $export->export($params, function ($pages) use (&$totalAmount, &$totalPaidFee, &$totalChargeFee, $total) {
|
||||
$datas = $this->model->sheepFilter()->with(['user'])
|
||||
->limit((($pages['page'] - 1) * $pages['list_rows']), $pages['list_rows'])
|
||||
->select();
|
||||
|
||||
$newDatas = [];
|
||||
foreach ($datas as $withdraw) {
|
||||
$user = $withdraw['user'] ?? null;
|
||||
$displayInfo = $withdraw['withdraw_info_display'] ?? ($withdraw['withdraw_info'] ?? []);
|
||||
|
||||
// 收款账户信息
|
||||
$payeeName = $displayInfo['真实姓名'] ?? ($displayInfo['姓名'] ?? ($displayInfo['微信用户'] ?? ''));
|
||||
$bankName = $displayInfo['开户行'] ?? ($displayInfo['开户银行'] ?? '');
|
||||
$cardNo = $displayInfo['银行卡号'] ?? ($displayInfo['卡号'] ?? ($displayInfo['支付宝账户'] ?? ($displayInfo['支付宝账号'] ?? ($displayInfo['微信ID'] ?? ''))));
|
||||
if ($cardNo !== '') {
|
||||
$cardNo = "\t" . $cardNo;
|
||||
}
|
||||
|
||||
// 提现资产类型
|
||||
$assetType = $withdraw['is_madow_withdraw'] ? 'DMEPA' : ($withdraw['is_money_withdraw'] ? '商城余额' : ($displayInfo['提现资产'] ?? '商城余额'));
|
||||
|
||||
// 资产折算明细
|
||||
$assetDetailParts = [];
|
||||
if (!empty($displayInfo['扣除DMEPA'])) {
|
||||
$assetDetailParts[] = '扣除: ' . $displayInfo['扣除DMEPA'];
|
||||
}
|
||||
if (!empty($displayInfo['市值汇率'])) {
|
||||
$assetDetailParts[] = $displayInfo['市值汇率'];
|
||||
}
|
||||
if (!empty($displayInfo['换算市值'])) {
|
||||
$assetDetailParts[] = '市值: ' . $displayInfo['换算市值'];
|
||||
}
|
||||
$assetDetail = implode('; ', $assetDetailParts);
|
||||
|
||||
$amount = floatval($withdraw['amount'] ?? 0);
|
||||
$paidFee = floatval($withdraw['paid_fee'] ?? 0) > 0 ? floatval($withdraw['paid_fee']) : floatval($withdraw['real_amount'] ?? $amount);
|
||||
$chargeFee = floatval($withdraw['charge_fee'] ?? 0);
|
||||
|
||||
$totalAmount = function_exists('bcadd') ? bcadd((string)$totalAmount, (string)$amount, 2) : ($totalAmount + $amount);
|
||||
$totalPaidFee = function_exists('bcadd') ? bcadd((string)$totalPaidFee, (string)$paidFee, 2) : ($totalPaidFee + $paidFee);
|
||||
$totalChargeFee = function_exists('bcadd') ? bcadd((string)$totalChargeFee, (string)$chargeFee, 2) : ($totalChargeFee + $chargeFee);
|
||||
|
||||
$newDatas[] = [
|
||||
'id' => $withdraw['id'],
|
||||
'withdraw_sn' => "\t" . (string)($withdraw['withdraw_sn'] ?? ''),
|
||||
'user_nickname' => $user['nickname'] ?? ('用户 ' . $withdraw['user_id']),
|
||||
'user_mobile' => "\t" . (string)($user['mobile'] ?? ''),
|
||||
'asset_type' => $assetType,
|
||||
'amount' => number_format($amount, 2, '.', ''),
|
||||
'paid_fee' => number_format($paidFee, 2, '.', ''),
|
||||
'charge_rate_format' => $withdraw['charge_rate_format'] ?? '0.0%',
|
||||
'charge_fee' => number_format($chargeFee, 2, '.', ''),
|
||||
'withdraw_type_text' => $withdraw['withdraw_type_text'] ?? '-',
|
||||
'payee_name' => $payeeName ?: '-',
|
||||
'bank_name' => $bankName ?: '-',
|
||||
'card_no' => $cardNo ?: '-',
|
||||
'asset_detail' => $assetDetail ?: '-',
|
||||
'status_text' => $withdraw['status_text'] ?? '-',
|
||||
'createtime' => $withdraw['createtime'] ?? '-',
|
||||
'updatetime' => $withdraw['updatetime'] ?? '-',
|
||||
];
|
||||
}
|
||||
|
||||
if ($pages['is_last_page']) {
|
||||
$newDatas[] = [
|
||||
'id' => '合计: 共 ' . $total . ' 条记录',
|
||||
'withdraw_sn' => '',
|
||||
'user_nickname' => '',
|
||||
'user_mobile' => '',
|
||||
'asset_type' => '',
|
||||
'amount' => number_format((float)$totalAmount, 2, '.', ''),
|
||||
'paid_fee' => number_format((float)$totalPaidFee, 2, '.', ''),
|
||||
'charge_rate_format' => '',
|
||||
'charge_fee' => number_format((float)$totalChargeFee, 2, '.', ''),
|
||||
'withdraw_type_text' => '',
|
||||
'payee_name' => '',
|
||||
'bank_name' => '',
|
||||
'card_no' => '',
|
||||
'asset_detail' => '',
|
||||
'status_text' => '',
|
||||
'createtime' => '',
|
||||
'updatetime' => '',
|
||||
];
|
||||
}
|
||||
|
||||
return $newDatas;
|
||||
});
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 提现日志
|
||||
*/
|
||||
|
||||
在新工单中引用
屏蔽一个用户