心理咨询网
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

extimage.html 3.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. {include file='common/head.html'}
  2. <div class="layui-body">
  3. <div class="layui-tab layui-tab-brief" lay-filter="tab">
  4. <ul class="layui-tab-title">
  5. <li class="layui-this" lay-id="t1">清理冗余图片</li>
  6. </ul>
  7. <div class="layui-tab-content">
  8. <div class="layui-tab-item layui-show">
  9. <blockquote class="layui-elem-quote layui-text">
  10. <ul>
  11. <li>
  12. 检测的字段有:公司微信图标、栏目设置中的缩略图、分类大图、内容缩略图、多图片、专题内容缩略图、多图片、link表logo、会员头像、站点logo、slide表pic。
  13. </li>
  14. <li>
  15. 清理前请务必备好本站数据,以免造成数据丢失,清理的图片会移到static/backup/ImageExt文件夹中,请及时检查站内是否有误删图片,确认无误后可删除static/backup/ImageExt文件夹。
  16. </li>
  17. <li>
  18. 注意:目前只会清理other和image的冗余文件
  19. </li>
  20. </ul>
  21. </blockquote>
  22. <a href="javascript:;" onclick="checkDataFile()" class="layui-btn">开始检查</a>
  23. <input type="hidden" id="check_data" data-url="{url./admin/ImageExt/checkDataFile}">
  24. <input type="hidden" id="do_ext" data-url="{url./admin/ImageExt/do_ext}">
  25. <table id="list" class="layui-hide">
  26. <button style="float: right;margin-left: 5px;" type="button" class="layui-btn layui-btn-danger ayui-btn layui-btn-sm layui-hide buttons" onclick="do_ext(1)">清理所有冗余文件</button>
  27. <button style="float: right" type="button" class="layui-btn layui-btn-normal ayui-btn layui-btn-sm layui-hide buttons" onclick="do_ext(0)">清理所选文件</button>
  28. </table>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. <script>
  34. function checkDataFile(){
  35. layui.use('table', function(){
  36. var table = layui.table;
  37. //第一个实例
  38. table.render({
  39. elem: '#list',
  40. height: 500,
  41. unresize:false,
  42. url: $("#check_data").data('url'),//数据接口,
  43. page: {
  44. limit:30,
  45. }, //开启分页,
  46. cols: [[ //表头
  47. {width:80, type: 'checkbox'},
  48. {field: 'static_path', title: '文件预览', templet: function (d){
  49. return '<img src="'+ d.static_path + '">';
  50. }},
  51. {field: 'real_path', title: '文件路径'},
  52. {field: 'update_time', title: '文件修改时间'}
  53. ]],
  54. done:function (res,curr,count){
  55. $('.layui-table-cell').css({'height':'auto'})
  56. }
  57. });
  58. });
  59. $(".layui-table").removeClass('layui-hide');
  60. $(".buttons").removeClass('layui-hide');
  61. }
  62. function do_ext(type){
  63. let jsonList = {};
  64. switch (type){
  65. case 0:
  66. jsonList = layui.table.checkStatus('list').data;
  67. break;
  68. case 1:
  69. break;
  70. }
  71. $.ajax({
  72. type: 'POST',
  73. url: $("#do_ext").data('url'),
  74. data:{type:type,list:jsonList},
  75. dataType: 'json',
  76. success: function (response) {
  77. if(response.code === 1){
  78. layer.msg('清理成功',{time: 1000},function (){
  79. location.reload();
  80. });
  81. }
  82. }
  83. });
  84. }
  85. </script>
  86. {include file='common/foot.html'}