bef40007eb838d673264b6e99e07f192.php 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:79:"C:\phpStudy\PHPTutorial\WWW\aqm-web\public/../application/admin\view\db\db.html";i:1557480234;s:75:"C:\phpStudy\PHPTutorial\WWW\aqm-web\application\admin\view\layout\home.html";i:1557480234;s:82:"C:\phpStudy\PHPTutorial\WWW\aqm-web\application\admin\view\layout\admin_items.html";i:1557480234;}*/ ?>
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. <meta charset="utf-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7. <title>安全猫官网</title>
  8. <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  9. <!-- Bootstrap 3.3.7 -->
  10. <link rel="stylesheet" href="<?php echo PLUGINS_SITE_ROOT; ?>/layui/css/layui.css">
  11. <link rel="stylesheet" href="<?php echo ADMIN_SITE_ROOT; ?>/css/admin.css">
  12. <link rel="stylesheet" href="<?php echo ADMIN_SITE_ROOT; ?>/iconfont/iconfont.css">
  13. <script src="<?php echo PLUGINS_SITE_ROOT; ?>/jquery-2.1.4.min.js"></script>
  14. <script src="<?php echo ADMIN_SITE_ROOT; ?>/js/admin.js"></script>
  15. <script type="text/javascript" src="<?php echo PLUGINS_SITE_ROOT; ?>/layui/layui.js"></script>
  16. <script type="text/javascript">
  17. var BASESITEROOT = "<?php echo BASE_SITE_ROOT; ?>";
  18. var ADMINSITEROOT = "<?php echo ADMIN_SITE_ROOT; ?>";
  19. var BASESITEURL = "<?php echo BASE_SITE_URL; ?>";
  20. var HOMESITEURL = "<?php echo HOME_SITE_URL; ?>";
  21. var ADMINSITEURL = "<?php echo ADMIN_SITE_URL; ?>";
  22. layui.use('layer', function () {
  23. var layer = layui.layer;
  24. });
  25. </script>
  26. </head>
  27. <body>
  28. <div class="layui-tab layui-tab-card">
  29. <?php if($admin_item): ?>
  30. <ul class="layui-tab-title">
  31. <?php if(is_array($admin_item) || $admin_item instanceof \think\Collection || $admin_item instanceof \think\Paginator): if( count($admin_item)==0 ) : echo "" ;else: foreach($admin_item as $key=>$item): if(array_intersect(explode(" ",str_replace("/", ".",substr($item['url'],7,-5))),$allpower) || array_intersect(explode(" ",str_replace("/", ".",substr($item['url'],31,-16))),$allpower)): ?>
  32. <li <?php if($item['name'] == $curitem): ?>class="layui-this" <?php endif; ?>>
  33. <a href="<?php echo $item['url']; ?>"><?php echo $item['text']; ?></a>
  34. <?php endif; ?>
  35. </li>
  36. <?php endforeach; endif; else: echo "" ;endif; ?>
  37. <div class="tool-btns">
  38. <a href="javascript:location.reload();" title="刷新当前页面" class="iconfont icon-reload"></i></a>
  39. </div>
  40. </ul>
  41. <?php endif; ?>
  42. <div class="layui-tab-content page-tab-content">
  43. <div class="explanation" id="explanation">
  44. <div class="title" id="checkZoom">
  45. <h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
  46. <span id="explanationZoom" title="收起提示" class="arrow"></span>
  47. </div>
  48. <ul>
  49. <li>1.会员相关信息。</li>
  50. </ul>
  51. </div>
  52. <div class="mDiv">
  53. <div class="ftitle">
  54. <div style="width: 100px;float: left;line-height: 56px;"><h3>数据库表列表</h3></div>
  55. <div style="width: 300px;float: left;line-height: 56px;"><h5>(共<?php echo $tableNum; ?>张记录,共计<?php echo $total; ?>)</h5></div>
  56. </div>
  57. <a id="export" class="layui-btn layui-btn-primary " style="background-color: #009688;color: #fff;margin-top: 10px;">数据备份</a>
  58. </div>
  59. <form method="post" id="export-form" action="<?php echo url('Admin/Db/export'); ?>">
  60. <div class="layui-tab-content page-tab-content">
  61. <table class="layui-table lay-even">
  62. <colgroup>
  63. <col width="80">
  64. <col width="200">
  65. <col width="100">
  66. <col width="200">
  67. <col width="200">
  68. <col width="150">
  69. <col>
  70. </colgroup>
  71. <thead>
  72. <tr>
  73. <th><input type="checkbox" onclick="javascript:$('input[name*=tables]').prop('checked', this.checked);">全选</th>
  74. <th>数据库表</th>
  75. <th>记录条数</th>
  76. <th>占用空间</th>
  77. <th>编码</th>
  78. <th>冗余</th>
  79. <th>创建时间</th>
  80. <th>备注</th>
  81. <th>操作</th>
  82. </tr>
  83. </thead>
  84. <tbody>
  85. <?php if(!(empty($list) || (($list instanceof \think\Collection || $list instanceof \think\Paginator ) && $list->isEmpty()))): if(is_array($list) || $list instanceof \think\Collection || $list instanceof \think\Paginator): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$db): $mod = ($i % 2 );++$i;?>
  86. <tr data-id="<?php echo $db['Name']; ?>">
  87. <td>
  88. <input type="checkbox" name="tables[]" value="<?php echo $db['Name']; ?>">
  89. </td>
  90. <td class="align-center">
  91. <?php echo $db['Name']; ?>
  92. </td>
  93. <td class="align-center">
  94. <?php echo $db['Rows']; ?>
  95. </td>
  96. <td class="align-center">
  97. <?php echo format_bytes($db['Data_length']); ?>
  98. </td>
  99. <td class="align-center">
  100. <?php echo $db['Collation']; ?>
  101. </td>
  102. <td><?php echo $db['Data_free']/1024; ?> kb
  103. </td>
  104. <td class="align-center">
  105. <?php echo $db['Create_time']; ?>
  106. </td>
  107. <td><?php echo $db['Comment']; ?>
  108. </td>
  109. <td class="align-center">
  110. <div style="text-align: center;">
  111. <a href="<?php echo url('Admin/Db/optimize',array('tablename'=>$db['Name'])); ?>" class="layui-btn layui-btn-xs">优化</a>
  112. <a href="<?php echo url('Admin/Db/repair',array('tablename'=>$db['Name'])); ?>" class="layui-btn layui-btn-xs layui-btn-danger">修复</a>
  113. </div>
  114. </td>
  115. </tr>
  116. <?php endforeach; endif; else: echo "" ;endif; else: ?>
  117. <tr class="no_data">
  118. <td colspan="11"><?php echo \think\Lang::get('ds_no_record'); ?></td>
  119. </tr>
  120. <?php endif; ?>
  121. </tbody>
  122. </table>
  123. </div>
  124. </form>
  125. </div>
  126. </div>
  127. <script>
  128. (function ($) {
  129. var $form = $("#export-form"), $export = $("#export"), tables;
  130. $export.click(function () {
  131. if ($("input[name^='tables']:checked").length == 0) {
  132. alert('请选中要备份的数据表');
  133. return false;
  134. }
  135. $export.addClass("disabled");
  136. $export.html("正在发送备份请求...");
  137. $.post(
  138. $form.attr("action"),
  139. $form.serialize(),
  140. function (data) {
  141. if (data.status) {
  142. tables = data.tables;
  143. $export.html(data.info + "开始备份,请不要关闭本页面!");
  144. backup(data.tab);
  145. window.onbeforeunload = function () {
  146. return "正在备份数据库,请不要关闭!"
  147. }
  148. } else {
  149. alert(data.info);
  150. $export.removeClass("disabled");
  151. $export.html("立即备份");
  152. }
  153. },
  154. "json"
  155. );
  156. return false;
  157. });
  158. function backup(tab, status) {
  159. status && showmsg(tab.id, "开始备份...(0%)");
  160. $.get($form.attr("action"), tab, function (data) {
  161. if (data.status) {
  162. showmsg(tab.id, data.info);
  163. if (!$.isPlainObject(data.tab)) {
  164. $export.removeClass("disabled");
  165. $export.html("备份完成,点击重新备份");
  166. window.onbeforeunload = function () {
  167. return null
  168. }
  169. return;
  170. }
  171. backup(data.tab, tab.id != data.tab.id);
  172. } else {
  173. $export.removeClass("disabled");
  174. $export.html("立即备份");
  175. }
  176. }, "json");
  177. }
  178. function showmsg(id, msg) {
  179. $("input[value=" + tables[id] + "]").closest("tr").find(".info").html(msg);
  180. // $("input[value=" + tables[id] + "]").closest("tr").hide(3000);
  181. }
  182. })(jQuery);
  183. </script>
  184. </body>
  185. </html>