仰望星辰工作室

better-staridc-MNBT

Z zfhsh first commit 2 个月前
1<?php
2/**
3 * qmzl_domain - 后台用户云账号管理
4 * 查看 / 解绑各用户绑定的启明智联平台账号。
5 */
6if (!defined('IN_CRONLITE')) exit;
7mnbt_admin_include('head');
8?>
9<div class="container-fluid p-t-15">
10 <div class="card">
11 <header class="card-header"><div class="card-title">启明智联域名 - 用户云账号</div></header>
12 <div class="card-body">
13 <div class="callout callout-info">
14 <p class="small">展示所有绑定启明智联平台账号的用户。账号密码加密存储于 <code>plg_qmzl_account</code>,此处仅用于排查与支持。</p>
15 </div>
16 <div id="toolbar" class="toolbar-btn-action">
17 <div class="form-inline">
18 <input type="text" class="form-control" id="search_keyword" placeholder="用户名 / 平台账号" style="width:220px;margin-right:8px;">
19 <button type="button" class="btn btn-primary" onclick="loadList(1)">
20 <span class="mdi mdi-magnify"></span> 查询
21 </button>
22 </div>
23 </div>
24 <table id="tb_accounts" data-page-size="10"></table>
25 </div>
26 </div>
27</div>
28
29<script type="text/javascript" src="<?=mnbt_asset_url('js/bootstrap-table/bootstrap-table.min.js')?>"></script>
30<script type="text/javascript" src="<?=mnbt_asset_url('js/bootstrap-table/locale/bootstrap-table-zh-CN.min.js')?>"></script>
31
32<script type="text/javascript">
33var $table = $("#tb_accounts");
34
35function loadList(page) {
36 msloading('加载中...');
37 $.post('ajax.php', {
38 gn: 'p_qmzl_admin_accounts',
39 page: 1,
40 limit: 1000,
41 keyword: $('#search_keyword').val() || ''
42 }, function (date) {
43 msloadingde();
44 var jsoe = typeof date === 'string' ? JSON.parse(date) : date;
45 if (jsoe.qk !== 1) { msalert(3, jsoe.msg || '加载失败', 4000); return; }
46 var data = jsoe.data || {};
47 $table.bootstrapTable('load', {
48 total: data.total || 0,
49 rows: data.rows || []
50 });
51 }).fail(function () { msloadingde(); msalert(3, '网络错误', 4000); });
52}
53
54function unbindAccount(userId, username) {
55 if (!confirm('确定解绑用户 ' + username + ' 的启明智联账号?')) return;
56 msloading('处理中...');
57 $.post('ajax.php', { gn: 'p_qmzl_admin_account_unbind', user_id: userId }, function (date) {
58 msloadingde();
59 var jsoe = typeof date === 'string' ? JSON.parse(date) : date;
60 if (jsoe.qk === 1) { msalert(1, '已解绑', 3000); loadList(1); }
61 else { msalert(3, jsoe.msg || '解绑失败', 4000); }
62 }).fail(function () { msloadingde(); msalert(3, '网络错误', 4000); });
63}
64
65$(function () {
66 $table.bootstrapTable({
67 columns: [
68 { field: 'id', title: 'ID', width: 60, align: 'center' },
69 { field: 'user_id', title: '用户ID', width: 80, align: 'center' },
70 { field: 'username', title: '用户名' },
71 { field: 'account', title: '平台账号' },
72 {
73 field: 'status', title: '状态', width: 90, align: 'center',
74 formatter: function (v) {
75 return v === 'error'
76 ? '<span class="label label-danger">异常</span>'
77 : '<span class="label label-success">正常</span>';
78 }
79 },
80 { field: 'last_msg', title: '最近信息', formatter: function (v) { return v || '-'; } },
81 { field: 'created_at', title: '绑定时间' },
82 { field: 'updated_at', title: '更新时间' },
83 {
84 field: 'op', title: '操作', width: 100, align: 'center', formatter: function (v, r) {
85 return '<button type="button" class="btn btn-xs btn-danger" onclick="unbindAccount(' + (parseInt(r.user_id, 10) || 0) + ',\'' + (r.username || '').replace(/'/g, '') + '\')">解绑</button>';
86 }
87 }
88 ],
89 pagination: true,
90 sidePagination: 'client',
91 pageSize: 10,
92 pageList: [10, 20, 50],
93 showRefresh: false
94 });
95 loadList(1);
96});
97</script>
98</body>
99</html>