fix(admin): 下线退款重发功能并优化用户详情页布局

- 移除后台订单和支付流水的退款重发按钮及接口
- 新增用户详情页分区导航和资金流水筛选功能
- 升级账号安全页面为企业资质认证功能
- 新增企业资质相关测试用例和图标
- 升级版本号至1.0.96
这个提交包含在:
2026-11-23 08:55:23 +08:00
父节点 230e39df5f
当前提交 d3cd6ba342
共有 18 个文件被更改,包括 231 次插入 和 321 次删除

查看文件

@@ -47,9 +47,11 @@ class Order extends Backend
return $this->selectpage();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$scopeUserId = $this->request->get('scope_user_id/d', 0);
$list = $this->model
->with(['user', 'master'])
->where($where)
->where(function ($query) use ($scopeUserId) { if ($scopeUserId > 0) $query->where('order.user_id', $scopeUserId); })
->order($sort, $order)
->paginate($limit);
@@ -762,69 +764,7 @@ class Order extends Backend
*/
public function retryrefund($ids = null)
{
if (!$this->request->isPost()) {
$this->error('非法请求方式');
}
$payOrderId = $this->request->post('pay_order_id/d', 0);
if ($payOrderId <= 0) {
$payOrderId = (int)$ids;
}
$po = Db::name('pay_order')->where('id', $payOrderId)->find();
if (!$po) {
$this->error('未找到指定的支付交易流水');
}
$order = Db::name('order')->where('id', (int)$po['order_id'])->find();
if (!$order) {
$this->error('关联业务订单不存在');
}
if ((int)$order['settle_status'] === 1) {
$this->error('该工单已完成向师傅结算分账,不允许再执行退款');
}
$status = (string)($po['status'] ?? '');
if ($status === 'refunding') {
$this->error('该流水处于微信退款处理中,请先点击【同步微信状态】核实是否已到账,切勿盲目重退');
}
if (!in_array($status, ['refund_failed', 'paid'], true)) {
$this->error('当前流水状态为「' . \app\common\library\PaymentService::payOrderStatusLabel($status) . '」,不可发起原路退款');
}
$reason = trim($this->request->post('reason/s', ''));
try {
$after = \app\common\library\PaymentService::refundSinglePayOrder(
$payOrderId,
$reason !== '' ? $reason : '管理员后台手动发起/重试原路退款'
);
} catch (\Throwable $e) {
$this->error('发起原路退款失败:' . $e->getMessage());
}
// 若主工单已处于取消状态且本笔退款受理/到账成功,同步汇总真实退款金额
if ((int)$order['status'] === 9 && in_array($after['status'] ?? '', ['refunding', 'refunded'], true)) {
$allPaid = Db::name('pay_order')
->where('order_id', (int)$order['id'])
->whereIn('status', ['paid', 'refunding', 'refunded', 'refund_failed'])
->select();
$hasUnsettledRefund = false;
$sumRefund = 0.00;
foreach ($allPaid as $item) {
if (in_array($item['status'], ['refunding', 'refunded'], true)) {
$sumRefund = round($sumRefund + (float)($item['refund_amount'] ?: $item['amount']), 2);
} else {
$hasUnsettledRefund = true;
}
}
Db::name('order')->where('id', (int)$order['id'])->update([
'pay_status' => $hasUnsettledRefund ? (int)$order['pay_status'] : 2,
'refund_amount' => $sumRefund,
'updatetime' => time(),
]);
}
$statusLabel = \app\common\library\PaymentService::payOrderStatusLabel($after['status'] ?? '');
$refundLabel = \app\common\library\PaymentService::refundStatusLabel($after['refund_status'] ?? 'none');
$this->success('微信原路退款请求已提交,当前状态:' . $statusLabel . '(' . $refundLabel . ')');
$this->error('退款重发暂不可用:请先核对原退款单及金额,再通过订单售后流程处理');
}
/**

查看文件

@@ -11,7 +11,7 @@ use think\exception\PDOException;
* 微信支付退款台账
*
* 展示全站微信支付流水(fa_pay_order)的支付/退款状态、网关回执与异常诊断,
* 提供人工同步微信退款状态与重发原路退款入口(复用 PaymentService 防资损校验)。
* 提供人工同步微信退款状态入口。
*
* @icon fa fa-undo
*/
@@ -109,25 +109,7 @@ class PayOrder extends Backend
*/
public function retryrefund($ids = null)
{
$id = (int)$ids;
$po = Db::name('pay_order')->where('id', $id)->find();
if (!$po) {
$this->error(__('No Results were found'));
}
$left = round((float)$po['amount'] - (float)$po['refund_amount'], 2);
if ($left <= 0) {
$this->error('该流水可退余额为 0,无需再次退款');
}
try {
$after = PaymentService::refundSinglePayOrder($id, '平台人工重发原路退款(退款台账)');
PaymentService::syncCancelledOrderRefund((int)$po['order_id']);
} catch (\Throwable $e) {
$this->error('重发退款失败:' . $e->getMessage());
return;
}
$statusLabel = PaymentService::payOrderStatusLabel($after['status'] ?? '');
$refundLabel = PaymentService::refundStatusLabel($after['refund_status'] ?? 'none');
$this->success('退款请求已提交:' . $statusLabel . '(' . $refundLabel . ',累计已退 ¥' . $after['refund_amount'] . ')');
$this->error('退款重发暂不可用:请先核对原退款单及金额,再通过订单售后流程处理');
}
/**
@@ -175,7 +157,7 @@ class PayOrder extends Backend
public function edit($ids = null)
{
$this->error('支付流水不可手工编辑,如需退款请使用行内"同步/重发退款"操作');
$this->error('支付流水不可手工编辑,如需退款请使用订单售后流程');
}
public function del($ids = null)

查看文件

@@ -34,9 +34,13 @@ class WalletLog extends Backend
public function index()
{
$this->request->filter(['strip_tags', 'trim']);
$scopeUserId = $this->request->get('scope_user_id/d', 0);
if (false === $this->request->isAjax()) {
$totalIncome = round((float)Db::name('wallet_log')->where('amount', '>', 0)->sum('amount'), 2);
$totalOutflow = round(abs((float)Db::name('wallet_log')->where('amount', '<', 0)->sum('amount')), 2);
$scope = function ($query) use ($scopeUserId) {
if ($scopeUserId > 0) $query->where('user_type', 'user')->where('user_id', $scopeUserId);
};
$totalIncome = round((float)Db::name('wallet_log')->where($scope)->where('amount', '>', 0)->sum('amount'), 2);
$totalOutflow = round(abs((float)Db::name('wallet_log')->where($scope)->where('amount', '<', 0)->sum('amount')), 2);
$this->view->assign([
'totalIncome' => $totalIncome,
'totalOutflow' => $totalOutflow,
@@ -49,6 +53,7 @@ class WalletLog extends Backend
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->where($where)
->where(function ($query) use ($scopeUserId) { if ($scopeUserId > 0) $query->where('user_type', 'user')->where('user_id', $scopeUserId); })
->order($sort, $order)
->paginate($limit);