feat: 新增后台人工充值功能及支付结果页

- 新增后台人工充值模块,支持上传支付凭证
- 新增支付结果查询接口及页面
- 新增订单支付成功跳转结果页逻辑
- 更新钱包流水类型标签区分充值方式
- 新增插件路由 PHP 8 兼容错误报告设置
这个提交包含在:
2026-11-19 16:22:14 +08:00
父节点 c37739656c
当前提交 5dd04b2f24
共有 28 个文件被更改,包括 468 次插入 和 44 次删除

查看文件

@@ -4,6 +4,7 @@ namespace app\admin\controller\user;
use app\common\controller\Backend;
use app\common\library\Auth;
use app\common\library\AdminRechargeService;
use think\Db;
/**
@@ -189,6 +190,12 @@ class User extends Backend
->order('id desc')
->limit(6)
->select();
$logIds = array_column($recentWalletLogs, 'id');
$rechargeMap = $logIds ? Db::name('admin_recharge')->where('wallet_log_id', 'in', $logIds)->column('voucher', 'wallet_log_id') : [];
foreach ($recentWalletLogs as &$walletLog) {
$walletLog['voucher'] = $rechargeMap[$walletLog['id']] ?? '';
}
unset($walletLog);
$this->view->assign([
'row' => $row,
@@ -205,6 +212,28 @@ class User extends Backend
return $this->view->fetch();
}
/** 后台凭支付凭证为用户充值。 */
public function recharge($ids = null)
{
$row = $this->model->get($ids);
if (!$row) {
$this->error(__('No Results were found'));
}
if ($this->request->isPost()) {
$this->token();
$params = $this->request->post('row/a', []);
try {
AdminRechargeService::credit((int)$row['id'], (int)$this->auth->id, $params['amount'] ?? '', $params['voucher'] ?? '', $params['request_id'] ?? '');
} catch (\Throwable $e) {
$this->error($e instanceof \RuntimeException ? $e->getMessage() : '充值失败,请联系管理员检查服务日志');
}
$this->success('充值成功');
}
$this->view->assign('row', $row);
$this->view->assign('requestId', bin2hex(random_bytes(16)));
return $this->view->fetch();
}
/**
* 添加
*/