feat: 新增提现详情页与撤销微信转账功能

新增分销提现单详情页面及接口,支持查看提现单据完整信息;新增后台撤销转账中提现单功能,前端添加对应操作按钮与交互逻辑;完善提现记录跳转逻辑,支持点击进入详情页,同时新增部署脚本同步线上代码。
这个提交包含在:
2026-10-28 17:46:51 +08:00
父节点 ea26329e80
当前提交 589d6aa216
共有 10 个文件被更改,包括 1144 次插入 和 4 次删除

查看文件

@@ -281,6 +281,24 @@ class Withdraw extends Backend
}
}
// 单笔精准反馈文案
if (count($withdraws) === 1) {
$row = $withdraws[0];
if ($errors) {
$this->error('同步失败:' . $errors[0]);
}
$latest = Db::name('fc_withdraw')->where('id', $row['id'])->find();
$transferStatus = (string)$latest['transfer_status'];
$stText = $transferStatus === 'WAIT_USER_CONFIRM' ? '待收款用户确认' : ($transferStatus === 'SUCCESS' ? '已转账成功' : ($transferStatus ?: '处理中'));
if ($latest['status'] === 'paid') {
$this->success('微信转账已完成,单据已更新为「已成功到账」');
} elseif ($latest['status'] === 'failed') {
$this->error('微信转账已失败/已撤销:' . ($latest['fail_reason'] ?: '未知原因'));
} else {
$this->success('已同步微信最新状态:' . $stText . '(微信已受理,需收款人在微信完成确认方可到账)');
}
}
$msg = '状态同步完成:';
if ($successCount > 0) {
$msg .= $successCount . ' 笔已确认到账;';
@@ -297,4 +315,33 @@ class Withdraw extends Backend
$this->success($msg);
}
/**
* 撤销「转账中」的微信转账提现单
*
* @return void
*/
public function cancel()
{
$id = (int)$this->request->post('id', 0);
if ($id <= 0) {
$this->error('参数错误');
}
$withdraw = Db::name('fc_withdraw')->where('id', $id)->find();
if (!$withdraw) {
$this->error('提现记录不存在');
}
if ((string)$withdraw['status'] !== 'paying') {
$this->error('只有处于「转账中」的记录方可撤销(当前:' . $withdraw['status'] . ')');
}
try {
$state = \app\common\library\WxTransfer::cancel($id);
} catch (\Throwable $e) {
$this->error('撤销失败:' . $e->getMessage());
}
$this->success('转账已成功撤销,款项额度已自动退回用户可提现余额');
}
}

查看文件

@@ -216,6 +216,9 @@
<button type="button" class="btn btn-info btn-action-sync" data-id="{$row.id}" style="padding:6px 16px;">
<i class="fa fa-refresh"></i> 查询微信转账最新状态
</button>
<button type="button" class="btn btn-danger btn-action-cancel" data-id="{$row.id}" data-no="{$row.withdraw_no}" style="padding:6px 16px;">
<i class="fa fa-times-circle"></i> 撤销微信转账
</button>
{/if}
<button type="button" class="btn btn-default" onclick="parent.Layer.close(parent.Layer.getFrameIndex(window.name));" style="padding:6px 16px;">关闭</button>

查看文件

@@ -376,6 +376,57 @@ class Distribution extends V1
$this->ok($list);
}
/**
* D8 提现单详情
* GET /api/v1/distribution/withdraw-detail 入参 {id|withdrawNo}
*
* @return void 输出提现流水单据详细信息JSON
*/
public function withdrawDetail()
{
$user = $this->auth();
$id = (int)$this->input('id', 0);
$no = trim((string)$this->input('withdrawNo', ''));
$query = Db::name('fc_withdraw')->where('user_id', $user['id']);
if ($id > 0) {
$query->where('id', $id);
} elseif ($no !== '') {
$query->where('withdraw_no', $no);
} else {
$this->fail('参数错误');
}
$row = $query->find();
if (!$row) {
$this->fail('提现记录不存在');
}
$epay = (array)get_addon_config('epay');
$wx = isset($epay['wechat']) && is_array($epay['wechat']) ? $epay['wechat'] : [];
$mchId = isset($wx['mch_id']) ? (string)$wx['mch_id'] : '1118898018';
$appId = isset($wx['miniapp_id']) ? (string)$wx['miniapp_id'] : 'wxbfcb778f3019cff8';
$this->ok([
'id' => (int)$row['id'],
'withdrawNo' => (string)$row['withdraw_no'],
'amount' => round((float)$row['amount'], 2),
'channel' => (string)$row['channel'],
'status' => (string)$row['status'],
'reason' => (string)$row['reason'],
'outBillNo' => (string)$row['out_bill_no'],
'transferStatus' => (string)$row['transfer_status'],
'transferId' => (string)$row['transfer_id'],
'packageInfo' => (string)$row['package_info'],
'failReason' => (string)$row['fail_reason'],
'createdAt' => $this->iso($row['createtime']),
'payTime' => !empty($row['paytime']) ? $this->iso($row['paytime']) : '',
'transferTime' => !empty($row['transfer_time']) ? $this->iso($row['transfer_time']) : '',
'transferMchId' => $mchId,
'transferAppId' => $appId,
]);
}
/**
* D7 手动输入邀请码补绑推荐人(老用户不支持自动补绑,仅支持通过手动填写邀请码完成补绑)
* POST /api/v1/distribution/bind 入参 {inviteCode}

查看文件

@@ -103,6 +103,7 @@ return [
'api/v1/distribution/poster' => 'api/Distribution/poster',
'api/v1/distribution/withdraw' => 'api/Distribution/withdraw',
'api/v1/distribution/withdraw-records' => 'api/Distribution/withdrawRecords',
'api/v1/distribution/withdraw-detail' => 'api/Distribution/withdrawDetail',
'api/v1/distribution/bind' => 'api/Distribution/bind',
/* =============== 六、用户端 · 消息中心(Module-MESSAGE) =============== */