仰望星辰工作室

better-staridc-MNBT

better-staridc-MNBT/ app_plugins/realname/admin/audit_detail.php 7.4 KB · 164 行 原始文件
Z zfhsh first commit 2 个月前
1<?php
2/**
3 * 管理员端 - 实名认证详情
4 */
5if (!defined('IN_CRONLITE')) {
6 exit;
7}
8$id = (int)($_GET['id'] ?? 0);
9$auth = $id > 0 ? realname_get_by_id($id) : null;
10$title = '实名认证详情';
11mnbt_admin_include('head');
12
13$statusMap = [
14 'pending' => ['待审核', 'warning'],
15 'approved' => ['已通过', 'success'],
16 'rejected' => ['已驳回', 'danger'],
17];
18$imgBase = '../index.php?_r=/realname/api/img';
19$typeMap = [
20 'front' => '身份证正面',
21 'back' => '身份证反面',
22 'hand' => '手持身份证',
23];
24?>
25<div class="container-fluid p-t-15">
26<?php if (!$auth): ?>
27 <div class="card"><div class="card-body text-center" style="color:#999;padding:40px">记录不存在或已删除。<br><br><a class="btn btn-primary btn-sm" href="plugin.php?p=realname&page=audits">返回列表</a></div></div>
28<?php else: ?>
29 <div class="row">
30 <div class="col-md-8">
31 <div class="card">
32 <div class="card-header">
33 <h4 style="display:inline-block">认证详情 #<?= (int)$auth['id'] ?></h4>
34 <?php $st = $statusMap[$auth['status']] ?? [$auth['status'], 'secondary']; ?>
35 <span class="badge badge-<?= $st[1] ?> ml-2"><?= $st[0] ?></span>
36 <span class="float-right"><a class="btn btn-default btn-sm" href="plugin.php?p=realname&page=audits">返回列表</a></span>
37 </div>
38 <div class="card-body">
39 <table class="table table-bordered">
40 <tr><th style="width:160px">用户名</th><td><?= htmlspecialchars($auth['username']) ?></td></tr>
41 <tr><th>用户 ID</th><td><?= (int)$auth['user_id'] ?></td></tr>
42 <tr><th>姓名</th><td><?= htmlspecialchars(realname_mask_name($auth['real_name'])) ?></td></tr>
43 <tr><th>手机号</th><td><?= htmlspecialchars(realname_mask_phone($auth['phone'])) ?></td></tr>
44 <tr><th>身份证号</th><td><?= htmlspecialchars(realname_mask_idcard(realname_decrypt($auth['id_card']))) ?>
45 <button class="btn btn-warning btn-xs ml-2" onclick="$('#decryptModal').modal('show')"><i class="mdi mdi-eye"></i> 解密查看</button>
46 </td></tr>
47 <tr><th>OCR 姓名</th><td><?= htmlspecialchars($auth['ocr_name'] !== '' ? $auth['ocr_name'] : '(未识别/未回填)') ?></td></tr>
48 <tr><th>OCR 身份证号</th><td><?= $auth['ocr_id_card'] !== '' ? htmlspecialchars(realname_mask_idcard(realname_decrypt($auth['ocr_id_card']))) : '(未识别/未回填)' ?></td></tr>
49 <tr><th>审核状态</th><td><span class="badge badge-<?= $st[1] ?>"><?= $st[0] ?></span></td></tr>
50 <tr><th>审核备注</th><td><?= htmlspecialchars((string)$auth['audit_note']) ?: '—' ?></td></tr>
51 <tr><th>提交时间</th><td><?= htmlspecialchars((string)$auth['created_at']) ?></td></tr>
52 <tr><th>审核时间</th><td><?= htmlspecialchars((string)$auth['audited_at']) ?: '—' ?></td></tr>
53 </table>
54 <?php if ($auth['status'] === 'pending'): ?>
55 <div class="mt-3">
56 <button class="btn btn-success" id="btnApprove"><i class="mdi mdi-check"></i> 审核通过</button>
57 <button class="btn btn-danger" id="btnReject" data-toggle="modal" data-target="#rejectModal"><i class="mdi mdi-close"></i> 驳回</button>
58 </div>
59 <?php elseif ($auth['status'] === 'rejected'): ?>
60 <div class="mt-3">
61 <button class="btn btn-success" id="btnApprove2"><i class="mdi mdi-check"></i> 强制通过</button>
62 </div>
63 <?php endif; ?>
64 </div>
65 </div>
66 </div>
67 <div class="col-md-4">
68 <div class="card">
69 <div class="card-header"><h4>证件照片</h4></div>
70 <div class="card-body">
71 <?php foreach ($typeMap as $key => $label): ?>
72 <div class="form-group text-center">
73 <label><?= $label ?></label>
74 <a href="<?= $imgBase ?>&id=<?= (int)$auth['id'] ?>&type=<?= $key ?>" target="_blank">
75 <img src="<?= $imgBase ?>&id=<?= (int)$auth['id'] ?>&type=<?= $key ?>" alt="<?= $label ?>"
76 style="width:100%;max-height:180px;object-fit:contain;border:1px solid #eee;border-radius:6px;background:#fafbfc;">
77 </a>
78 </div>
79 <?php endforeach; ?>
80 <p class="text-muted" style="font-size:12px">点击图片可查看原图。照片仅管理员可见。</p>
81 </div>
82 </div>
83 </div>
84 </div>
85
86 <!-- 解密查看 Modal -->
87 <div class="modal fade" id="decryptModal" tabindex="-1">
88 <div class="modal-dialog modal-sm">
89 <div class="modal-content">
90 <div class="modal-header"><h5 class="modal-title">解密查看身份证号</h5><button type="button" class="close" data-dismiss="modal">&times;</button></div>
91 <div class="modal-body">
92 <div class="form-group">
93 <label>后台管理密码</label>
94 <input type="password" class="form-control" id="decryptPass" placeholder="输入后台密码确认身份">
95 </div>
96 <div id="decryptResult" style="display:none;background:#f8f9fa;padding:10px;border-radius:6px;margin-top:8px;"></div>
97 </div>
98 <div class="modal-footer">
99 <button class="btn btn-secondary" data-dismiss="modal">取消</button>
100 <button class="btn btn-warning" id="btnDecryptOk">确认查看</button>
101 </div>
102 </div>
103 </div>
104 </div>
105
106 <!-- 驳回原因 Modal -->
107 <div class="modal fade" id="rejectModal" tabindex="-1">
108 <div class="modal-dialog modal-sm">
109 <div class="modal-content">
110 <div class="modal-header"><h5 class="modal-title">驳回认证</h5><button type="button" class="close" data-dismiss="modal">&times;</button></div>
111 <div class="modal-body">
112 <textarea class="form-control" id="rejectNote" rows="3" placeholder="请填写驳回原因,将展示给用户"></textarea>
113 </div>
114 <div class="modal-footer">
115 <button class="btn btn-secondary" data-dismiss="modal">取消</button>
116 <button class="btn btn-danger" id="btnRejectOk">确认驳回</button>
117 </div>
118 </div>
119 </div>
120 </div>
121<?php endif; ?>
122</div>
123
124<script>
125var AUTH_ID = <?= $auth ? (int)$auth['id'] : 0 ?>;
126
127function doApprove() {
128 if (!confirm('确认通过该认证?')) return;
129 $.post('ajax.php', { gn: 'realname_admin_approve', id: AUTH_ID }, function (res) {
130 try { res = typeof res === 'string' ? JSON.parse(res) : res; } catch (e) {}
131 alert(res && res.code === 'ok' ? '已通过' : (res && res.code ? res.code : '操作失败'));
132 if (res && res.code === 'ok') location.reload();
133 });
134}
135$('#btnApprove').on('click', doApprove);
136$('#btnApprove2').on('click', doApprove);
137
138$('#btnRejectOk').on('click', function () {
139 var note = $('#rejectNote').val();
140 if (!note) { alert('请填写驳回原因'); return; }
141 $.post('ajax.php', { gn: 'realname_admin_reject', id: AUTH_ID, note: note }, function (res) {
142 try { res = typeof res === 'string' ? JSON.parse(res) : res; } catch (e) {}
143 alert(res && res.code === 'ok' ? '已驳回' : (res && res.code ? res.code : '操作失败'));
144 if (res && res.code === 'ok') location.reload();
145 });
146});
147
148$('#btnDecryptOk').on('click', function () {
149 var pass = $('#decryptPass').val();
150 if (!pass) { alert('请输入后台管理密码'); return; }
151 $.post('ajax.php', { gn: 'realname_admin_decrypt', id: AUTH_ID, password: pass }, function (res) {
152 try { res = typeof res === 'string' ? JSON.parse(res) : res; } catch (e) {}
153 if (!res || res.code !== 'ok') { alert(res && res.code ? res.code : '操作失败'); return; }
154 $('#decryptResult').html(
155 '<b>姓名:</b>' + res.real_name + '<br>'
156 + '<b>手机号:</b>' + res.phone + '<br>'
157 + '<b>身份证号:</b>' + res.id_card + '<br>'
158 + (res.ocr_name ? '<b>OCR姓名:</b>' + res.ocr_name + '<br>' : '')
159 + (res.ocr_id_card ? '<b>OCR身份证号:</b>' + res.ocr_id_card : '')
160 ).show();
161 });
162});
163</script>
164<?php mnbt_admin_include('foot'); ?>