mirror of
https://github.com/LyLme/lylme_spage.git
synced 2024-11-17 14:34:08 +08:00
优化代码
This commit is contained in:
parent
b0ff923693
commit
3de5a549c9
14
assets/admin/css/bootstrap.min.css
vendored
Normal file
14
assets/admin/css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
assets/admin/css/coloris.min.css
vendored
Normal file
1
assets/admin/css/coloris.min.css
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.clr-picker{display:none;flex-wrap:wrap;position:absolute;width:200px;z-index:1000;border-radius:10px;background-color:#fff;justify-content:space-between;box-shadow:0 0 5px rgba(0,0,0,.05),0 5px 20px rgba(0,0,0,.1);-moz-user-select:none;-webkit-user-select:none;user-select:none}.clr-picker.clr-open{display:flex}.clr-dark{background-color:#444}.clr-gradient{position:relative;width:100%;height:100px;margin-bottom:15px;border-radius:3px 3px 0 0;background-image:linear-gradient(rgba(0,0,0,0),#000),linear-gradient(90deg,#fff,currentColor);cursor:pointer}.clr-marker{position:absolute;width:12px;height:12px;margin:-6px 0 0 -6px;border:1px solid #fff;border-radius:50%;background-color:currentColor;cursor:pointer}.clr-picker input[type=range]::-webkit-slider-runnable-track{width:100%;height:8px}.clr-picker input[type=range]::-webkit-slider-thumb{width:8px;height:8px;-webkit-appearance:none}.clr-picker input[type=range]::-moz-range-track{width:100%;height:8px;border:0}.clr-picker input[type=range]::-moz-range-thumb{width:8px;height:8px;border:0}.clr-hue{background-image:linear-gradient(to right,red 0,#ff0 16.66%,#0f0 33.33%,#0ff 50%,#00f 66.66%,#f0f 83.33%,red 100%)}.clr-alpha,.clr-hue{position:relative;width:calc(100% - 40px);height:8px;margin:5px 20px;border-radius:4px}.clr-alpha span{display:block;height:100%;width:100%;border-radius:inherit;background-image:linear-gradient(90deg,rgba(0,0,0,0),currentColor)}.clr-alpha input,.clr-hue input{position:absolute;width:calc(100% + 16px);height:16px;left:-8px;top:-4px;margin:0;background-color:transparent;opacity:0;cursor:pointer;appearance:none;-webkit-appearance:none}.clr-alpha div,.clr-hue div{position:absolute;width:16px;height:16px;left:0;top:0;margin:-4px 0 0 -8px;border:2px solid #fff;border-radius:50%;background-color:currentColor;box-shadow:0 0 1px #888;pointer-events:none}.clr-alpha div:before{content:'';position:absolute;height:100%;width:100%;left:0;top:0;border-radius:50%;background-color:currentColor}.clr-swatches{order:2;width:calc(100% - 40px);margin:0 20px}.clr-swatches div{display:flex;flex-wrap:wrap;padding-bottom:12px;justify-content:center}.clr-swatches button{position:relative;width:20px;height:20px;margin:0 8px 6px 0;border:0;border-radius:50%;color:inherit;text-indent:-1000px;white-space:nowrap;overflow:hidden;cursor:pointer}.clr-swatches button:last-child,.clr-swatches button:nth-child(6n){margin-right:0}.clr-swatches button:after{content:'';display:block;position:absolute;width:100%;height:100%;left:0;top:0;border-radius:inherit;background-color:currentColor;box-shadow:inset 0 0 0 1px rgba(0,0,0,.1)}.clr-dark .clr-swatches button:after{box-shadow:inset 0 0 0 1px rgba(255,255,255,.3)}input.clr-color{order:1;width:120px;height:32px;margin:15px 20px 15px 0;padding:0 15px;border:1px solid #ddd;border-radius:16px;color:#444;background-color:#fff;font-family:sans-serif;font-size:14px;text-align:left;box-shadow:none}.clr-dark input.clr-color{color:#fff;border-color:#777;background-color:#555}input.clr-color:focus{outline:0;border:1px solid #aaa}.clr-preview{position:relative;width:32px;height:32px;margin:15px 0 20px 20px;border:0;border-radius:50%;overflow:hidden;cursor:pointer}.clr-preview:after,.clr-preview:before{content:'';position:absolute;height:100%;width:100%;left:0;top:0;border:1px solid #fff;border-radius:50%}.clr-preview:after{border:0;background-color:currentColor;box-shadow:inset 0 0 0 1px rgba(0,0,0,.1)}.clr-dark .clr-preview:after{box-shadow:inset 0 0 0 1px rgba(255,255,255,.5)}.clr-alpha div,.clr-color,.clr-hue div,.clr-marker{box-sizing:border-box}.clr-field{display:inline-block;position:relative;color:#000}.clr-field button{position:absolute;width:30px;height:100%;right:0;top:50%;transform:translateY(-50%);border:0;color:inherit;text-indent:-1000px;white-space:nowrap;overflow:hidden;pointer-events:none}.clr-field button:after{content:'';display:block;position:absolute;width:100%;height:100%;left:0;top:0;border-radius:inherit;background-color:currentColor;box-shadow:inset 0 0 1px rgba(0,0,0,.5)}.clr-alpha,.clr-alpha div,.clr-field button,.clr-preview:before,.clr-swatches button{background-image:repeating-linear-gradient(45deg,#aaa 25%,transparent 25%,transparent 75%,#aaa 75%,#aaa),repeating-linear-gradient(45deg,#aaa 25%,#fff 25%,#fff 75%,#aaa 75%,#aaa);background-position:0 0,4px 4px;background-size:8px 8px}.clr-marker:focus{outline:0}.clr-keyboard-nav .clr-alpha input:focus+div,.clr-keyboard-nav .clr-hue input:focus+div,.clr-keyboard-nav .clr-marker:focus{outline:0;box-shadow:0 0 0 2px #1e90ff,0 0 2px 2px #fff}
|
1
assets/admin/css/materialdesignicons.min.css
vendored
Normal file
1
assets/admin/css/materialdesignicons.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
4538
assets/admin/css/style.min.css
vendored
Normal file
4538
assets/admin/css/style.min.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
51
assets/admin/css/theme_setting.css
Normal file
51
assets/admin/css/theme_setting.css
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
.layui-form-item>.layui-input-block>tip {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #a29c9c;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layui-form-item>.layui-input-block>tip a {
|
||||||
|
color: #33cabb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layui-form-item {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
clear: both;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layui-input-block {
|
||||||
|
margin-left: 0;
|
||||||
|
min-height: 36px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layui-form-label {
|
||||||
|
float: left;
|
||||||
|
display: block;
|
||||||
|
padding: 0;
|
||||||
|
width: 100%;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: left;
|
||||||
|
color: #4d5259;
|
||||||
|
}
|
||||||
|
.layui-form-select dl dd.layui-this {
|
||||||
|
background-color: #33cabb;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layui-form-radio:hover *,
|
||||||
|
.layui-form-radioed,
|
||||||
|
.layui-form-radioed>i {
|
||||||
|
color: #33cabb;
|
||||||
|
}
|
||||||
|
.clr-alpha {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea::-webkit-input-placeholder,input::-webkit-input-placeholder {
|
||||||
|
color: #aaaaaa;
|
||||||
|
}
|
BIN
assets/admin/fonts/materialdesignicons.eot
Normal file
BIN
assets/admin/fonts/materialdesignicons.eot
Normal file
Binary file not shown.
6150
assets/admin/fonts/materialdesignicons.svg
Normal file
6150
assets/admin/fonts/materialdesignicons.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 2.1 MiB |
BIN
assets/admin/fonts/materialdesignicons.ttf
Normal file
BIN
assets/admin/fonts/materialdesignicons.ttf
Normal file
Binary file not shown.
BIN
assets/admin/fonts/materialdesignicons.woff
Normal file
BIN
assets/admin/fonts/materialdesignicons.woff
Normal file
Binary file not shown.
BIN
assets/admin/fonts/materialdesignicons.woff2
Normal file
BIN
assets/admin/fonts/materialdesignicons.woff2
Normal file
Binary file not shown.
18962
assets/admin/js/Chart.js
vendored
Normal file
18962
assets/admin/js/Chart.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
186
assets/admin/js/apply.js
Normal file
186
assets/admin/js/apply.js
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
//全选
|
||||||
|
function check_all() {
|
||||||
|
var ischecked = $("#check_all").prop('checked');
|
||||||
|
if (ischecked == true) {
|
||||||
|
$('[name="link-check"]').prop('checked', true);
|
||||||
|
} else {
|
||||||
|
$('[name="link-check"]').prop('checked', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//获取选中状态
|
||||||
|
function get_check() {
|
||||||
|
var chk_value = [];
|
||||||
|
$('input[name="link-check"]:checked').each(function () {
|
||||||
|
chk_value.push($(this).val());
|
||||||
|
});
|
||||||
|
return chk_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 审核
|
||||||
|
function checked_status(status) {
|
||||||
|
if (get_check().length == 0) {
|
||||||
|
layer.msg('未选择链接');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
lightyear.loading('show');
|
||||||
|
$.ajax({
|
||||||
|
url: "ajax_apply.php?set=status",
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
id: get_check(),
|
||||||
|
status: status
|
||||||
|
},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
lightyear.loading('hide');
|
||||||
|
if (data.code == 200) {
|
||||||
|
lightyear.notify(data.msg, 'success', 1000);
|
||||||
|
$("#applylist").load(location.href + " #applylist>*", "");
|
||||||
|
} else {
|
||||||
|
lightyear.notify(data.msg, 'danger', 1000);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
layer.msg('服务器错误');
|
||||||
|
lightyear.loading('hide');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//选中删除
|
||||||
|
function checked_del(id) {
|
||||||
|
var link_id = [];
|
||||||
|
link_id.push(id);
|
||||||
|
link_id = id ? link_id : get_check();
|
||||||
|
if (link_id.length == 0) {
|
||||||
|
layer.msg('未选择链接');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.alert({
|
||||||
|
title: '警告',
|
||||||
|
content: '确定要删除吗?删除后不可恢复',
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
text: '删除',
|
||||||
|
btnClass: 'btn-danger',
|
||||||
|
action: function () {
|
||||||
|
lightyear.loading('show');
|
||||||
|
$.ajax({
|
||||||
|
url: "ajax_apply.php?set=delete",
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
id: link_id
|
||||||
|
},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
lightyear.loading('hide');
|
||||||
|
if (data.code == 200) {
|
||||||
|
lightyear.notify(data.msg, 'success', 1000);
|
||||||
|
$("#applylist").load(location.href + " #applylist>*", "");
|
||||||
|
} else {
|
||||||
|
lightyear.notify(data.msg, 'danger', 1000);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
layer.msg('服务器错误');
|
||||||
|
lightyear.loading('hide');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cancel: {
|
||||||
|
text: '取消'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//审核状态
|
||||||
|
function status(id, status) {
|
||||||
|
$.ajax({
|
||||||
|
url: "ajax_apply.php?set=status",
|
||||||
|
type: "POST",
|
||||||
|
dataType: "json",
|
||||||
|
data: {
|
||||||
|
id: id,
|
||||||
|
status: status
|
||||||
|
},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
lightyear.loading('hide');
|
||||||
|
if (data.code == 200) {
|
||||||
|
lightyear.notify(data.msg, 'success', 1000);
|
||||||
|
$("#applylist").load(location.href + " #applylist>*", "");
|
||||||
|
} else {
|
||||||
|
lightyear.notify(data.msg, 'danger', 1000);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
layer.msg('服务器错误');
|
||||||
|
lightyear.loading('hide');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function deletes(id) {
|
||||||
|
$.alert({
|
||||||
|
title: '警告',
|
||||||
|
content: '确定要删除吗?删除后不可恢复',
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
text: '删除',
|
||||||
|
btnClass: 'btn-danger',
|
||||||
|
action: function () {
|
||||||
|
lightyear.loading('show');
|
||||||
|
$.ajax({
|
||||||
|
url: "ajax_apply.php?set=delete",
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
lightyear.loading('hide');
|
||||||
|
if (data.code == 200) {
|
||||||
|
lightyear.notify(data.msg, 'success', 1000);
|
||||||
|
$("#applylist").load(location.href + " #applylist>*", "");
|
||||||
|
} else {
|
||||||
|
lightyear.notify(data.msg, 'danger', 1000);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
|
||||||
|
lightyear.loading('hide');
|
||||||
|
layer.msg('服务器错误');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cancel: {
|
||||||
|
text: '取消'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
$("img.lazy").lazyload({
|
||||||
|
threshold: 100
|
||||||
|
});
|
||||||
|
$(document).ready(function () {
|
||||||
|
$(".lazys").click(function () {
|
||||||
|
$(this).attr('src', '/assets/admin/loading.gif');
|
||||||
|
$(this).lazyload();
|
||||||
|
});
|
||||||
|
});
|
2
assets/admin/js/bootstrap-notify.min.js
vendored
Normal file
2
assets/admin/js/bootstrap-notify.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7
assets/admin/js/bootstrap.min.js
vendored
Normal file
7
assets/admin/js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
6
assets/admin/js/coloris.min.js
vendored
Normal file
6
assets/admin/js/coloris.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
146
assets/admin/js/group.js
Normal file
146
assets/admin/js/group.js
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
function listTable(query) {
|
||||||
|
var url = window.document.location.href.toString();
|
||||||
|
var queryString = url.split("?")[1];
|
||||||
|
query = query || queryString;
|
||||||
|
layer.closeAll();
|
||||||
|
var ii = layer.load(2, { shade: [0.1, '#fff'] });
|
||||||
|
$.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: 'table_group.php?' + query,
|
||||||
|
dataType: 'html',
|
||||||
|
cache: false,
|
||||||
|
success: function (data) {
|
||||||
|
layer.close(ii);
|
||||||
|
$("#listTable").html(data);
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
layer.msg('服务器错误');
|
||||||
|
lightyear.loading('hide');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//载入页面
|
||||||
|
$(document).ready(function () {
|
||||||
|
if ($("#listTable").length > 0) {
|
||||||
|
listTable()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$(document).on('click', '.sort-up', function () {
|
||||||
|
//上移
|
||||||
|
if ($(this).parents('tr').prevAll().length > 0) {
|
||||||
|
$(this).parents('tr').prev().before($(this).parents('tr').prop('outerHTML'));
|
||||||
|
$(this).parents('tr').remove();
|
||||||
|
save_order();
|
||||||
|
}
|
||||||
|
}).on('click', '.sort-down', function () {
|
||||||
|
//下移
|
||||||
|
if ($(this).parents('tr').nextAll().length > 0) {
|
||||||
|
$(this).parents('tr').next().after($(this).parents('tr').prop('outerHTML'));
|
||||||
|
$(this).parents('tr').remove();
|
||||||
|
save_order();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//保存排序
|
||||||
|
function save_order() {
|
||||||
|
var groups = [];
|
||||||
|
var $inputArr = $('input[name="group_id"]');
|
||||||
|
$inputArr.each(function () {
|
||||||
|
groups.push($(this).val());
|
||||||
|
});
|
||||||
|
|
||||||
|
lightyear.loading('show');
|
||||||
|
$.ajax({
|
||||||
|
url: "group.php?set=sort",
|
||||||
|
method: "POST",
|
||||||
|
data: { groups: groups },
|
||||||
|
success: function (data) {
|
||||||
|
lightyear.loading('hide');
|
||||||
|
lightyear.notify('操作成功!', 'success', 1000);
|
||||||
|
listTable();
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
layer.msg('服务器错误');
|
||||||
|
lightyear.loading('hide');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//启用分组
|
||||||
|
function on_group(id) {
|
||||||
|
lightyear.loading('show');
|
||||||
|
$.ajax({
|
||||||
|
url: "group.php?set=on",
|
||||||
|
method: "POST",
|
||||||
|
data: { group_id: id },
|
||||||
|
success: function (data) {
|
||||||
|
lightyear.loading('hide');
|
||||||
|
lightyear.notify('操作成功!', 'success', 1000);
|
||||||
|
listTable();
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
layer.msg('服务器错误');
|
||||||
|
lightyear.loading('hide');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//禁用分组
|
||||||
|
function off_group(id) {
|
||||||
|
lightyear.loading('show');
|
||||||
|
$.ajax({
|
||||||
|
url: "group.php?set=off",
|
||||||
|
method: "POST",
|
||||||
|
data: { group_id: id },
|
||||||
|
success: function (data) {
|
||||||
|
lightyear.loading('hide');
|
||||||
|
lightyear.notify('操作成功!', 'success', 1000);
|
||||||
|
listTable();
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
layer.msg('服务器错误');
|
||||||
|
lightyear.loading('hide');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除分组
|
||||||
|
function del_group(id) {
|
||||||
|
$.confirm({
|
||||||
|
title: '警告',
|
||||||
|
content: '删除分组会<b>同时删除该分组下的所有链接</b>,该操作不可逆!<br><font color="red">是否继续?</font>',
|
||||||
|
type: 'red',
|
||||||
|
typeAnimated: true,
|
||||||
|
buttons: {
|
||||||
|
tryAgain: {
|
||||||
|
text: '确定',
|
||||||
|
btnClass: 'btn-red',
|
||||||
|
action: function () {
|
||||||
|
lightyear.loading('show');
|
||||||
|
$.ajax({
|
||||||
|
url: "group.php?set=del",
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
group_id: id
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
lightyear.loading('hide');
|
||||||
|
lightyear.notify('操作成功!', 'success', 1000);
|
||||||
|
listTable();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
close: {
|
||||||
|
text: '取消'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
9
assets/admin/js/jquery-confirm.min.css
vendored
Normal file
9
assets/admin/js/jquery-confirm.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
10
assets/admin/js/jquery-confirm.min.js
vendored
Normal file
10
assets/admin/js/jquery-confirm.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
3
assets/admin/js/jquery.dragsort-0.5.2.min.js
vendored
Normal file
3
assets/admin/js/jquery.dragsort-0.5.2.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
assets/admin/js/jquery.lazyload.min.js
vendored
Normal file
2
assets/admin/js/jquery.lazyload.min.js
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/*! Lazy Load 1.9.1 - MIT license - Copyright 2010-2013 Mika Tuupola */
|
||||||
|
!function(a,b,c,d){var e=a(b);a.fn.lazyload=function(f){function g(){var b=0;i.each(function(){var c=a(this);if(!j.skip_invisible||c.is(":visible"))if(a.abovethetop(this,j)||a.leftofbegin(this,j));else if(a.belowthefold(this,j)||a.rightoffold(this,j)){if(++b>j.failure_limit)return!1}else c.trigger("appear"),b=0})}var h,i=this,j={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:b,data_attribute:"original",skip_invisible:!0,appear:null,load:null,placeholder:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC"};return f&&(d!==f.failurelimit&&(f.failure_limit=f.failurelimit,delete f.failurelimit),d!==f.effectspeed&&(f.effect_speed=f.effectspeed,delete f.effectspeed),a.extend(j,f)),h=j.container===d||j.container===b?e:a(j.container),0===j.event.indexOf("scroll")&&h.bind(j.event,function(){return g()}),this.each(function(){var b=this,c=a(b);b.loaded=!1,(c.attr("src")===d||c.attr("src")===!1)&&c.is("img")&&c.attr("src",j.placeholder),c.one("appear",function(){if(!this.loaded){if(j.appear){var d=i.length;j.appear.call(b,d,j)}a("<img />").bind("load",function(){var d=c.attr("data-"+j.data_attribute);c.hide(),c.is("img")?c.attr("src",d):c.css("background-image","url('"+d+"')"),c[j.effect](j.effect_speed),b.loaded=!0;var e=a.grep(i,function(a){return!a.loaded});if(i=a(e),j.load){var f=i.length;j.load.call(b,f,j)}}).attr("src",c.attr("data-"+j.data_attribute))}}),0!==j.event.indexOf("scroll")&&c.bind(j.event,function(){b.loaded||c.trigger("appear")})}),e.bind("resize",function(){g()}),/(?:iphone|ipod|ipad).*os 5/gi.test(navigator.appVersion)&&e.bind("pageshow",function(b){b.originalEvent&&b.originalEvent.persisted&&i.each(function(){a(this).trigger("appear")})}),a(c).ready(function(){g()}),this},a.belowthefold=function(c,f){var g;return g=f.container===d||f.container===b?(b.innerHeight?b.innerHeight:e.height())+e.scrollTop():a(f.container).offset().top+a(f.container).height(),g<=a(c).offset().top-f.threshold},a.rightoffold=function(c,f){var g;return g=f.container===d||f.container===b?e.width()+e.scrollLeft():a(f.container).offset().left+a(f.container).width(),g<=a(c).offset().left-f.threshold},a.abovethetop=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollTop():a(f.container).offset().top,g>=a(c).offset().top+f.threshold+a(c).height()},a.leftofbegin=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollLeft():a(f.container).offset().left,g>=a(c).offset().left+f.threshold+a(c).width()},a.inviewport=function(b,c){return!(a.rightoffold(b,c)||a.leftofbegin(b,c)||a.belowthefold(b,c)||a.abovethetop(b,c))},a.extend(a.expr[":"],{"below-the-fold":function(b){return a.belowthefold(b,{threshold:0})},"above-the-top":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-screen":function(b){return a.rightoffold(b,{threshold:0})},"left-of-screen":function(b){return!a.rightoffold(b,{threshold:0})},"in-viewport":function(b){return a.inviewport(b,{threshold:0})},"above-the-fold":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-fold":function(b){return a.rightoffold(b,{threshold:0})},"left-of-fold":function(b){return!a.rightoffold(b,{threshold:0})}})}(jQuery,window,document);
|
4
assets/admin/js/jquery.min.js
vendored
Normal file
4
assets/admin/js/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
assets/admin/js/layer.css
Normal file
1
assets/admin/js/layer.css
Normal file
File diff suppressed because one or more lines are too long
1
assets/admin/js/layer.min.js
vendored
Normal file
1
assets/admin/js/layer.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
88
assets/admin/js/lightyear.js
Normal file
88
assets/admin/js/lightyear.js
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
var lightyear = function(){
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面loading
|
||||||
|
*/
|
||||||
|
var pageLoader = function($mode) {
|
||||||
|
var $loadingEl = jQuery('#lyear-loading');
|
||||||
|
$mode = $mode || 'show';
|
||||||
|
if ($mode === 'show') {
|
||||||
|
if ($loadingEl.length) {
|
||||||
|
$loadingEl.fadeIn(250);
|
||||||
|
} else {
|
||||||
|
jQuery('body').prepend('<div id="lyear-loading"><div class="spinner-border text-primary" role="status"><span class="sr-only">Loading...</span></div></div>');
|
||||||
|
}
|
||||||
|
} else if ($mode === 'hide') {
|
||||||
|
if ($loadingEl.length) {
|
||||||
|
$loadingEl.fadeOut(250);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面小提示
|
||||||
|
* @param $msg 提示信息
|
||||||
|
* @param $type 提示类型:'info', 'success', 'warning', 'danger'
|
||||||
|
* @param $delay 毫秒数,例如:1000
|
||||||
|
* @param $icon 图标,例如:'fa fa-user' 或 'glyphicon glyphicon-warning-sign'
|
||||||
|
* @param $from 'top' 或 'bottom'
|
||||||
|
* @param $align 'left', 'right', 'center'
|
||||||
|
* @param $url 跳转链接 例如: https://www.xxxx.com
|
||||||
|
* @author CaiWeiMing <314013107@qq.com>
|
||||||
|
*/
|
||||||
|
var tips = function ($msg, $type, $delay, $icon, $from, $align, $url) {
|
||||||
|
$type = $type || 'info';
|
||||||
|
$delay = $delay || 1000;
|
||||||
|
$from = $from || 'top';
|
||||||
|
$align = $align || 'center';
|
||||||
|
$enter = $type == 'danger' ? 'animated shake' : 'animated fadeInUp';
|
||||||
|
$url = $url || url;
|
||||||
|
jQuery.notify({
|
||||||
|
icon: $icon,
|
||||||
|
message: $msg
|
||||||
|
},
|
||||||
|
{
|
||||||
|
element: 'body',
|
||||||
|
type: $type,
|
||||||
|
allow_dismiss: true,
|
||||||
|
newest_on_top: true,
|
||||||
|
showProgressbar: false,
|
||||||
|
placement: {
|
||||||
|
from: $from,
|
||||||
|
align: $align
|
||||||
|
},
|
||||||
|
offset: 20,
|
||||||
|
spacing: 10,
|
||||||
|
z_index: 10800,
|
||||||
|
delay: $delay,
|
||||||
|
//timer: 1000,
|
||||||
|
animate: {
|
||||||
|
enter: $enter,
|
||||||
|
exit: 'animated fadeOutDown'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if($url!=''){
|
||||||
|
setTimeout(function(){
|
||||||
|
window.location.href=$url;
|
||||||
|
},$delay);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var url = '';
|
||||||
|
|
||||||
|
return {
|
||||||
|
// 页面小提示
|
||||||
|
notify : function ($msg, $type, $delay, $icon, $from, $align, $url) {
|
||||||
|
tips($msg, $type, $delay, $icon, $from, $align, $url);
|
||||||
|
},
|
||||||
|
url : function ($url){
|
||||||
|
url=$url;
|
||||||
|
},
|
||||||
|
// 页面加载动画
|
||||||
|
loading : function ($mode) {
|
||||||
|
pageLoader($mode);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}();
|
448
assets/admin/js/link.js
Normal file
448
assets/admin/js/link.js
Normal file
@ -0,0 +1,448 @@
|
|||||||
|
//请求页面
|
||||||
|
function listTable(query) {
|
||||||
|
var url = window.document.location.href.toString();
|
||||||
|
var queryString = url.split("?")[1];
|
||||||
|
query = query || queryString;
|
||||||
|
layer.closeAll();
|
||||||
|
var ii = layer.load(2, { shade: [0.1, '#fff'] });
|
||||||
|
$.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: 'table_link.php?' + query,
|
||||||
|
dataType: 'html',
|
||||||
|
cache: false,
|
||||||
|
success: function (data) {
|
||||||
|
layer.close(ii);
|
||||||
|
$("#listTable").html(data);
|
||||||
|
$("#link").dragsort({
|
||||||
|
dragBetween: true,
|
||||||
|
dragSelector: "td.lylme",
|
||||||
|
dragEnd: showbutton,
|
||||||
|
placeHolderTemplate: "<tr></tr>",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
layer.msg('服务器错误');
|
||||||
|
lightyear.loading('hide');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//载入页面
|
||||||
|
$(document).ready(function () {
|
||||||
|
if ($("#listTable").length > 0) {
|
||||||
|
listTable()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//获取选中
|
||||||
|
function get_check() {
|
||||||
|
var chk_value = [];
|
||||||
|
$('input[name="link-check"]:checked').each(function () {
|
||||||
|
chk_value.push($(this).val());
|
||||||
|
});
|
||||||
|
return chk_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//多选启用
|
||||||
|
function on_link() {
|
||||||
|
if (get_check().length == 0) {
|
||||||
|
$.alert("未选择链接");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
lightyear.loading('show');
|
||||||
|
$.ajax({
|
||||||
|
url: "ajax_link.php?submit=on",
|
||||||
|
method: "POST",
|
||||||
|
data: { links: get_check() },
|
||||||
|
success: function (data) {
|
||||||
|
lightyear.loading('hide');
|
||||||
|
if (data.code == 200) {
|
||||||
|
lightyear.notify(data.msg, 'success', 1000);
|
||||||
|
listTable();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lightyear.notify(data.msg, 'danger', 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
layer.msg('服务器错误');
|
||||||
|
lightyear.loading('hide');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//多选禁用
|
||||||
|
function off_link() {
|
||||||
|
if (get_check().length == 0) {
|
||||||
|
$.alert("未选择链接");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
lightyear.loading('show');
|
||||||
|
$.ajax({
|
||||||
|
url: "ajax_link.php?submit=off",
|
||||||
|
method: "POST",
|
||||||
|
data: { links: get_check() },
|
||||||
|
success: function (data) {
|
||||||
|
lightyear.loading('hide');
|
||||||
|
if (data.code == 200) {
|
||||||
|
lightyear.notify(data.msg, 'success', 1000);
|
||||||
|
listTable();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lightyear.notify(data.msg, 'danger', 1000);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
layer.msg('服务器错误');
|
||||||
|
lightyear.loading('hide');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//获取网站信息
|
||||||
|
function geturl() {
|
||||||
|
var url = $("input[name=\'url\']").val();
|
||||||
|
if (!url) {
|
||||||
|
layer.msg('链接地址不能为空');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$('#loading').css("display", "flex");
|
||||||
|
if (!/^http[s]?:\/\/+/.test(url) && url != "") {
|
||||||
|
var url = "http://" + url;
|
||||||
|
$("input[name=\'url\']").val(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "ajax_link.php?submit=geturl",
|
||||||
|
type: "GET",
|
||||||
|
dataType: "json",
|
||||||
|
data: { url: url },
|
||||||
|
success: function (data) {
|
||||||
|
$("input[name=\'name\']").val(data.title);
|
||||||
|
if (!data.title && !data.icon) {
|
||||||
|
layer.msg('获取失败,请手动填写');
|
||||||
|
}
|
||||||
|
else if (!data.icon) {
|
||||||
|
layer.msg('未获取到网站图标');
|
||||||
|
}
|
||||||
|
layer.msg('正则抓取目标网站图标...');
|
||||||
|
downloadimg(data.icon, url);
|
||||||
|
$('#loading').css("display", "none");
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
layer.msg('获取失败,目标网站无法访问或防火墙限制!');
|
||||||
|
$('#loading').css("display", "none");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//抓取网站图标
|
||||||
|
function downloadimg(url, referer) {
|
||||||
|
$.ajax({
|
||||||
|
url: "/include/file.php",
|
||||||
|
type: "POST",
|
||||||
|
dataType: "json",
|
||||||
|
data: { url: url, referer: referer },
|
||||||
|
success: function (data) {
|
||||||
|
if (data.code == '200') {
|
||||||
|
layer.msg(data.msg);
|
||||||
|
$("textarea[name=\'icon\']").val(data.url);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
layer.msg(data.msg);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
layer.msg('服务器错误');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//上传图标
|
||||||
|
function uploadimg(e) {
|
||||||
|
var formData = new FormData();
|
||||||
|
formData.append("file", $("#file")[0].files[0]);
|
||||||
|
$.ajax({
|
||||||
|
method: 'POST',
|
||||||
|
url: '/include/file.php',
|
||||||
|
data: formData,
|
||||||
|
timeout: 20000,
|
||||||
|
cache: false,
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
|
dataType: "JSON",
|
||||||
|
success: function (data) {
|
||||||
|
if (data.code == '200') {
|
||||||
|
layer.msg(data.msg);
|
||||||
|
$("textarea[name=\'icon\']").val(data.url);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
layer.msg(data.msg);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
layer.msg('服务器错误');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//多选删除
|
||||||
|
function del_link(id) {
|
||||||
|
var link_id = [];
|
||||||
|
link_id.push(id);
|
||||||
|
link_id = id ? link_id : get_check();
|
||||||
|
if (link_id.length == 0) {
|
||||||
|
$.alert("未选择链接");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$.alert({
|
||||||
|
title: '警告',
|
||||||
|
content: '确定要删除吗?删除后不可恢复',
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
text: '删除',
|
||||||
|
btnClass: 'btn-danger',
|
||||||
|
action: function () {
|
||||||
|
lightyear.loading('show');
|
||||||
|
$.ajax({
|
||||||
|
url: "ajax_link.php?submit=del",
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
links: link_id
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
lightyear.loading('hide');
|
||||||
|
|
||||||
|
console.log(data.msg);
|
||||||
|
if (data.code == 200) {
|
||||||
|
lightyear.notify(data.msg, 'success', 1000);
|
||||||
|
listTable();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lightyear.notify(data.msg, 'danger', 1000);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
layer.msg('服务器错误');
|
||||||
|
lightyear.loading('hide');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cancel: {
|
||||||
|
text: '取消'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//全选
|
||||||
|
function check_all() {
|
||||||
|
var ischecked = $("#check_all").prop('checked');
|
||||||
|
if (ischecked == true) {
|
||||||
|
$('[name="link-check"]').prop('checked', true);
|
||||||
|
} else {
|
||||||
|
$('[name="link-check"]').prop('checked', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//拖拽排序
|
||||||
|
$(document).ready(function () {
|
||||||
|
$("#link").dragsort({
|
||||||
|
itemSelector: "tr",
|
||||||
|
dragEnd: showbutton,
|
||||||
|
dragBetween: true, dragSelector: "tr", placeHolderTemplate: "<tr></tr>"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
//显示保存
|
||||||
|
function showbutton() {
|
||||||
|
$("#save_order").show();
|
||||||
|
}
|
||||||
|
|
||||||
|
//保存拖拽排序
|
||||||
|
function save_order() {
|
||||||
|
var link_array = [];
|
||||||
|
var $inputArr = $('input[name="link-check"]');
|
||||||
|
$inputArr.each(function () {
|
||||||
|
link_array.push($(this).val());
|
||||||
|
});
|
||||||
|
|
||||||
|
lightyear.loading('show');
|
||||||
|
$.ajax({
|
||||||
|
url: "ajax_link.php?submit=allorder",
|
||||||
|
method: "POST",
|
||||||
|
data: { link_array: link_array },
|
||||||
|
success: function (data) {
|
||||||
|
lightyear.loading('hide');
|
||||||
|
if (data.code == 200) {
|
||||||
|
lightyear.notify(data.msg, 'success', 1000);
|
||||||
|
listTable();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lightyear.notify(data.msg, 'danger', 1000);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
layer.msg('服务器错误');
|
||||||
|
lightyear.loading('hide');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//点击排序
|
||||||
|
$(document).on('click', '.sort-up', function () {
|
||||||
|
//上移一行
|
||||||
|
if ($(this).parents('tr').prevAll().length > 0) {
|
||||||
|
$(this).parents('tr').prev().before($(this).parents('tr').prop('outerHTML'));
|
||||||
|
$(this).parents('tr').remove();
|
||||||
|
save_order();
|
||||||
|
}
|
||||||
|
}).on('click', '.sort-down', function () {
|
||||||
|
//下移一行
|
||||||
|
if ($(this).parents('tr').nextAll().length > 0) {
|
||||||
|
$(this).parents('tr').next().after($(this).parents('tr').prop('outerHTML'));
|
||||||
|
$(this).parents('tr').remove();
|
||||||
|
save_order();
|
||||||
|
}
|
||||||
|
}).on('click', '.sort-goup', function () {
|
||||||
|
//移到顶部
|
||||||
|
if ($(this).parents('tr').prevAll().length > 0) {
|
||||||
|
$(this).parents('tbody').children("tr:first-child").before($(this).parents('tr').prop('outerHTML'));
|
||||||
|
$(this).parents('tr').remove();
|
||||||
|
save_order();
|
||||||
|
}
|
||||||
|
}).on('click', '.sort-godown', function () {
|
||||||
|
//移到底部
|
||||||
|
if ($(this).parents('tr').nextAll().length > 0) {
|
||||||
|
$(this).parents('tbody').children("tr:last-child").after($(this).parents('tr').prop('outerHTML'));
|
||||||
|
$(this).parents('tr').remove();
|
||||||
|
save_order();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
//移到分组
|
||||||
|
function edit_group(mv_group) {
|
||||||
|
if (get_check().length == 0) {
|
||||||
|
$.alert("未选择链接");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$.confirm({
|
||||||
|
title: '移动分组',
|
||||||
|
content: mv_group,
|
||||||
|
buttons: {
|
||||||
|
formSubmit: {
|
||||||
|
text: '移动',
|
||||||
|
btnClass: 'btn-blue',
|
||||||
|
action: function () {
|
||||||
|
var group_id = this.$content.find('.group_id').val();
|
||||||
|
if (!group_id) {
|
||||||
|
$.alert('请选择要移动到的分组');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
lightyear.loading('show');
|
||||||
|
$.ajax({
|
||||||
|
url: "ajax_link.php?submit=set_group",
|
||||||
|
method: "POST",
|
||||||
|
data: { links: get_check(), group_id: group_id },
|
||||||
|
success: function (data) {
|
||||||
|
lightyear.loading('hide');
|
||||||
|
if (data.code == 200) {
|
||||||
|
lightyear.notify(data.msg, 'success', 1000);
|
||||||
|
listTable();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lightyear.notify(data.msg, 'danger', 1000);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
layer.msg('服务器错误');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cancel: {
|
||||||
|
text: '取消'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
//链接加密
|
||||||
|
function pwd_link(pwd_list) {
|
||||||
|
if (get_check().length == 0) {
|
||||||
|
$.alert("未选择链接");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$.confirm({
|
||||||
|
title: '加密链接',
|
||||||
|
content: pwd_list,
|
||||||
|
buttons: {
|
||||||
|
formSubmit: {
|
||||||
|
text: '加密',
|
||||||
|
btnClass: 'btn-blue',
|
||||||
|
action: function () {
|
||||||
|
var pwd_id = this.$content.find('.pwd_id').val();
|
||||||
|
if (!pwd_id) {
|
||||||
|
$.alert('请选择添加到的加密组');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
lightyear.loading('show');
|
||||||
|
$.ajax({
|
||||||
|
url: "ajax_link.php?submit=pwd_link",
|
||||||
|
method: "POST",
|
||||||
|
data: { links: get_check(), pwd_id: pwd_id },
|
||||||
|
success: function (data) {
|
||||||
|
|
||||||
|
lightyear.loading('hide');
|
||||||
|
if (data.code == 200) {
|
||||||
|
lightyear.notify(data.msg, 'success', 1000);
|
||||||
|
listTable();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lightyear.notify(data.msg, 'danger', 1000);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
layer.msg('服务器错误');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cancel: {
|
||||||
|
text: '取消'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function pwd_links() {
|
||||||
|
$.alert({
|
||||||
|
title: '分组已加密',
|
||||||
|
content: '当前分组已设置为加密,若想单独设置链接加密,请先删除该分组的加密',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$(document).on('click', '.tips', function () {
|
||||||
|
$.alert({
|
||||||
|
title: '提示',
|
||||||
|
content: '<hr><h4>拖动排序</h4><li>在电脑端可以拖拽链接的<b>名称</b>进行排序,拖拽完成后点击“保存排序”即可生效</li><hr><h4>链接加密</h4><li>加密后的链接地址在本页面显示为<font color="#f96197">粉色</font>,以便标识</li><li>加密分组后该分组下的链接单独设置的加密将失效,删除分组的加密后即可恢复</li><li><b>加密后链接只能使用密码登录后方可查看</b></li>',
|
||||||
|
});
|
||||||
|
});
|
161
assets/admin/js/main.min.js
vendored
Normal file
161
assets/admin/js/main.min.js
vendored
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
;
|
||||||
|
|
||||||
|
jQuery( function() {
|
||||||
|
$("body").on('click','[data-stopPropagation]',function (e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 滚动条
|
||||||
|
const ps = new PerfectScrollbar('.lyear-layout-sidebar-scroll', {
|
||||||
|
swipeEasing: false,
|
||||||
|
suppressScrollX: true
|
||||||
|
});
|
||||||
|
|
||||||
|
// 侧边栏
|
||||||
|
$(document).on('click', '.lyear-aside-toggler', function() {
|
||||||
|
$('.lyear-layout-sidebar').toggleClass('lyear-aside-open');
|
||||||
|
$("body").toggleClass('lyear-layout-sidebar-close');
|
||||||
|
|
||||||
|
if ($('.lyear-mask-modal').length == 0) {
|
||||||
|
$('<div class="lyear-mask-modal"></div>').prependTo('body');
|
||||||
|
} else {
|
||||||
|
$( '.lyear-mask-modal' ).remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 遮罩层
|
||||||
|
$(document).on('click', '.lyear-mask-modal', function() {
|
||||||
|
$( this ).remove();
|
||||||
|
$('.lyear-layout-sidebar').toggleClass('lyear-aside-open');
|
||||||
|
$('body').toggleClass('lyear-layout-sidebar-close');
|
||||||
|
});
|
||||||
|
|
||||||
|
// 侧边栏导航
|
||||||
|
$(document).on('click', '.nav-item-has-subnav > a', function() {
|
||||||
|
$subnavToggle = jQuery( this );
|
||||||
|
$navHasSubnav = $subnavToggle.parent();
|
||||||
|
$topHasSubNav = $subnavToggle.parents('.nav-item-has-subnav').last();
|
||||||
|
$subnav = $navHasSubnav.find('.nav-subnav').first();
|
||||||
|
$viSubHeight = $navHasSubnav.siblings().find('.nav-subnav:visible').outerHeight();
|
||||||
|
$scrollBox = $('.lyear-layout-sidebar-scroll');
|
||||||
|
$navHasSubnav.siblings().find('.nav-subnav:visible').slideUp(500).parent().removeClass('open');
|
||||||
|
$subnav.slideToggle( 300, function() {
|
||||||
|
$navHasSubnav.toggleClass( 'open' );
|
||||||
|
|
||||||
|
// 新增滚动条处理
|
||||||
|
var scrollHeight = 0;
|
||||||
|
pervTotal = $topHasSubNav.prevAll().length,
|
||||||
|
boxHeight = $scrollBox.outerHeight(),
|
||||||
|
innerHeight = $('.sidebar-main').outerHeight(),
|
||||||
|
thisScroll = $scrollBox.scrollTop(),
|
||||||
|
thisSubHeight = $(this).outerHeight(),
|
||||||
|
footHeight = 121;
|
||||||
|
|
||||||
|
if (footHeight + innerHeight - boxHeight >= (pervTotal * 48)) {
|
||||||
|
scrollHeight = pervTotal * 48;
|
||||||
|
}
|
||||||
|
if ($subnavToggle.parents('.nav-item-has-subnav').length == 1) {
|
||||||
|
$scrollBox.animate({scrollTop: scrollHeight}, 300);
|
||||||
|
} else {
|
||||||
|
// 子菜单操作
|
||||||
|
if (typeof($viSubHeight) != 'undefined' && $viSubHeight != null) {
|
||||||
|
scrollHeight = thisScroll + thisSubHeight - $viSubHeight;
|
||||||
|
$scrollBox.animate({scrollTop: scrollHeight}, 300);
|
||||||
|
} else {
|
||||||
|
if ((thisScroll + boxHeight - $scrollBox[0].scrollHeight) == 0) {
|
||||||
|
scrollHeight = thisScroll - thisSubHeight;
|
||||||
|
$scrollBox.animate({scrollTop: scrollHeight}, 300);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 提示
|
||||||
|
if($('[data-toggle="tooltip"]')[0]) {
|
||||||
|
$('[data-toggle="tooltip"]').tooltip({
|
||||||
|
"container" : 'body',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 弹出框
|
||||||
|
if($('[data-toggle="popover"]')[0]) {
|
||||||
|
$('[data-toggle="popover"]').popover();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 标签
|
||||||
|
$('.js-tags-input').each(function() {
|
||||||
|
var $this = $(this);
|
||||||
|
$this.tagsInput({
|
||||||
|
height: $this.data('height') ? $this.data('height') : '38px',
|
||||||
|
width: '100%',
|
||||||
|
defaultText: $this.attr("placeholder"),
|
||||||
|
removeWithBackspace: true,
|
||||||
|
delimiter: [',']
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 时间选择
|
||||||
|
jQuery('.js-datetimepicker').each(function() {
|
||||||
|
var $input = jQuery(this);
|
||||||
|
$input.datetimepicker({
|
||||||
|
format: $input.data('format') ? $input.data('format') : false,
|
||||||
|
useCurrent: $input.data('use-current') ? $input.data('use-current') : false,
|
||||||
|
locale: moment.locale('' + ($input.data('locale') ? $input.data('locale') : '') + ''),
|
||||||
|
showTodayButton: $input.data('show-today-button') ? $input.data('show-today-button') : false,
|
||||||
|
showClear: $input.data('show-clear') ? $input.data('show-clear') : false,
|
||||||
|
showClose: $input.data('show-close') ? $input.data('show-close') : false,
|
||||||
|
sideBySide: $input.data('side-by-side') ? $input.data('side-by-side') : false,
|
||||||
|
inline: $input.data('inline') ? $input.data('inline') : false,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 日期选择
|
||||||
|
jQuery('.js-datepicker').each(function() {
|
||||||
|
var options = {
|
||||||
|
weekStart: 1,
|
||||||
|
autoclose: typeof($(this).data('auto-close')) != 'undefined' ? $(this).data('auto-close') : true,
|
||||||
|
language: 'zh-CN', // 默认简体中文
|
||||||
|
multidateSeparator: ', ', // 默认多个日期用,分隔
|
||||||
|
format: $(this).data('date-format') ? $(this).data('date-format') : 'yyyy-mm-dd',
|
||||||
|
};
|
||||||
|
|
||||||
|
if ( $(this).prop("tagName") != 'INPUT' ) {
|
||||||
|
options.inputs = [$(this).find('input:first'), $(this).find('input:last')];
|
||||||
|
}
|
||||||
|
|
||||||
|
$(this).datepicker(options);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 颜色选取
|
||||||
|
jQuery('.js-colorpicker').each(function() {
|
||||||
|
var $colorpicker = jQuery(this);
|
||||||
|
var $colorpickerMode = $colorpicker.data('colorpicker-mode') ? $colorpicker.data('colorpicker-mode') : 'hex';
|
||||||
|
var $colorpickerinline = $colorpicker.data('colorpicker-inline') ? true: false;
|
||||||
|
$colorpicker.colorpicker({
|
||||||
|
'format': $colorpickerMode,
|
||||||
|
'inline': $colorpickerinline
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 复选框全选
|
||||||
|
$("#check-all").change(function () {
|
||||||
|
if ($boxname = $(this).data('name')) {
|
||||||
|
$(this).closest('table').find("input[name='" + $boxname + "']").prop('checked', $(this).prop("checked"));
|
||||||
|
} else {
|
||||||
|
$(this).closest('table').find(".lyear-checkbox input[type='checkbox']").prop('checked', $(this).prop("checked"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 设置主题配色
|
||||||
|
setTheme = function(input_name, data_name) {
|
||||||
|
$("input[name='"+input_name+"']").click(function(){
|
||||||
|
$('body').attr(data_name, $(this).val());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
setTheme('site_theme', 'data-theme');
|
||||||
|
setTheme('logo_bg', 'data-logobg');
|
||||||
|
setTheme('header_bg', 'data-headerbg');
|
||||||
|
setTheme('sidebar_bg', 'data-sidebarbg');
|
||||||
|
|
||||||
|
});
|
6
assets/admin/js/perfect-scrollbar.min.js
vendored
Normal file
6
assets/admin/js/perfect-scrollbar.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
125
assets/admin/js/theme_setting.js
Normal file
125
assets/admin/js/theme_setting.js
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
layui.use(['form'], function() {
|
||||||
|
var form = layui.form,
|
||||||
|
layer = layui.layer,
|
||||||
|
$ = layui.$;
|
||||||
|
//监听提交
|
||||||
|
form.on('submit(saveBtn)', function(data) {
|
||||||
|
if (data.form.method == 'get') {
|
||||||
|
|
||||||
|
} else if (data.form.method == 'post') {
|
||||||
|
$.post(
|
||||||
|
data.form.action,
|
||||||
|
data.field,
|
||||||
|
function(res) {
|
||||||
|
if (res.code != 200) {
|
||||||
|
layer.alert(res.msg || '失败', {
|
||||||
|
icon: 2
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
layer.msg(res.msg, {
|
||||||
|
icon: 1,
|
||||||
|
}, function() {
|
||||||
|
//do something
|
||||||
|
//parent.window.location.reload(); //打开注释可以重载页面
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"json"
|
||||||
|
)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
layui.use(['layer', 'upload', 'element'], function() {
|
||||||
|
var layer = layui.layer,
|
||||||
|
$ = layui.$;
|
||||||
|
|
||||||
|
function generateRdStr() {
|
||||||
|
var text = "";
|
||||||
|
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
|
for (var i = 0; i < 10; i++) {
|
||||||
|
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
var upload = layui.upload,
|
||||||
|
element = layui.element;
|
||||||
|
$("input[input_type='file']").parent().append("<ul class='upload_box' style='overflow:hidden;_zoom:1;padding-left:0px;'></ul>");
|
||||||
|
$('ul.upload_box').each(function(i) {
|
||||||
|
$('ul.upload_box').eq(i).append($('ul.upload_box').eq(i).siblings("input[input_type='file']"));
|
||||||
|
});
|
||||||
|
$("input[input_type='file']").wrap("<li style='width: 150px;height: 150px;background: #EFEFEF;float: left;overflow:hidden;border: 4px dashed #ddd;margin-right: 10px; position: relative;margin-bottom: 10px;'></li>")
|
||||||
|
$('ul.upload_box li').each(function(i) {
|
||||||
|
var upload_item = $('ul.upload_box li').eq(i),
|
||||||
|
id_name = generateRdStr();
|
||||||
|
upload_item.attr('id', id_name);
|
||||||
|
upload_item.append("<div class='add' style='font-size: 80px; color: #CCCCCC;width: 100%;text-align: center;line-height: 150px;position: relative;z-index: 1'>+</div>")
|
||||||
|
upload_item.append("<div class='preview' style='width: 100%;height: 100%;position: absolute;z-index: 2;top: 0px;'></div>")
|
||||||
|
upload_item.append("<div class='layui-progress' lay-showPercent='yes' style='position: relative;z-index: 3;bottom: 16px;' lay-filter='" + id_name + "_process' >" +
|
||||||
|
"<div class='layui-progress-bar' lay-percent='0%'></div>" +
|
||||||
|
"</div>");
|
||||||
|
upload_item.append("<div class='remove' style='z-index:3;position: absolute;width: 14px;height: 14px;line-height:14px;text-align:center;background: #E9523F;color:#fff;overflow:hidden;border-radius:5px;right: 0px;top: 17px;'>X</div>");
|
||||||
|
$('#' + id_name + ' .remove').hide();
|
||||||
|
$('#' + id_name + ' .preview').hide();
|
||||||
|
$('#' + id_name + ' .layui-progress').hide();
|
||||||
|
$('#' + id_name + ' .remove').on('click', function() {
|
||||||
|
$('#' + id_name + ' .remove').hide();
|
||||||
|
$('#' + id_name + ' .preview').hide();
|
||||||
|
$('#' + id_name + ' .layui-progress').hide();
|
||||||
|
$('#' + id_name + ' .layui-progress').find('.layui-progress-bar').removeClass('layui-bg-red');
|
||||||
|
})
|
||||||
|
var init_val = $('#' + id_name).find("input[type='text']").hide().val() || '';
|
||||||
|
if (init_val.length > 0) {
|
||||||
|
$('#' + id_name + ' .remove').show();
|
||||||
|
$('#' + id_name + ' .preview').css({
|
||||||
|
'background': 'url(' + init_val + ')',
|
||||||
|
'background-repeat': 'no-repeat',
|
||||||
|
'background-size': '100% 100%',
|
||||||
|
}).show();
|
||||||
|
}
|
||||||
|
var uploadIns = upload.render({
|
||||||
|
elem: '#' + id_name + ' .add',
|
||||||
|
url: '../include/file.php?crop=no',
|
||||||
|
field: 'file',
|
||||||
|
method: 'post',
|
||||||
|
before: function(obj) {
|
||||||
|
|
||||||
|
},
|
||||||
|
choose: function(obj) {
|
||||||
|
$('#' + id_name + ' .remove').show();
|
||||||
|
$('#' + id_name + ' .layui-progress').show();
|
||||||
|
obj.preview(function(index, file, result) {
|
||||||
|
$('#' + id_name + ' .preview').css({
|
||||||
|
'background': 'url(' + result + ')',
|
||||||
|
'background-repeat': 'no-repeat',
|
||||||
|
'background-size': '100% 100%',
|
||||||
|
}).show();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
progress: function(n, elem) {
|
||||||
|
var percent = n + '%' //获取进度百分比
|
||||||
|
element.progress(id_name + '_process', percent); //可配合 layui 进度条元素使用
|
||||||
|
},
|
||||||
|
done: function(res) {
|
||||||
|
if (res.code != 200) {
|
||||||
|
layer.alert(res.msg || '接口出错')
|
||||||
|
} else {
|
||||||
|
$('#' + id_name).find("input[type='text']").attr({
|
||||||
|
value: res.url || ''
|
||||||
|
});
|
||||||
|
layer.msg(res.msg || '上传成功', {
|
||||||
|
icon: 1,
|
||||||
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
layer.alert('接口出错')
|
||||||
|
$('#' + id_name + ' .layui-progress').find('.layui-progress-bar').addClass('layui-bg-red');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
});
|
BIN
assets/admin/loading.gif
Normal file
BIN
assets/admin/loading.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
9
assets/css/viewer.min.css
vendored
Normal file
9
assets/css/viewer.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1,21 +1,67 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/*
|
||||||
* 作者:LyLme
|
* @Description: 用于获取Bing每日壁纸,以PHP文件返回图片
|
||||||
* 说明:用于获取Bing每日壁纸,以PHP文件返回图片
|
* @Author: LyLme admin@lylme.com
|
||||||
* 时间:2022-01-20
|
* @Date: 2024-01-23 12:25:35
|
||||||
|
* @LastEditors: LyLme admin@lylme.com
|
||||||
|
* @LastEditTime: 2024-04-13 23:19:55
|
||||||
|
* @FilePath: /lylme_spage/assets/img/bing.php
|
||||||
|
* @Copyright (c) 2024 by LyLme, All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$str=file_get_contents('http://cn.bing.com/HPImageArchive.aspx?idx=0&n=1');
|
$str = get_curl('http://cn.bing.com/HPImageArchive.aspx?idx=0&n=1');
|
||||||
if(preg_match("/<url>(.+?)<\/url>/is",$str,$matches)){
|
if (preg_match("/<url>(.+?)<\/url>/is", $str, $matches)) {
|
||||||
$imgurl='http://cn.bing.com'.$matches[1];
|
$imgurl = 'http://cn.bing.com' . $matches[1];
|
||||||
}
|
}
|
||||||
if($imgurl){
|
if (!empty($imgurl)) {
|
||||||
header('Content-Type: image/JPEG');
|
$currentHour = date('H'); // 获取当前小时
|
||||||
@ob_end_clean();
|
$tenAMTimestamp = strtotime(date('Y-m-d 10:00:00'));
|
||||||
@readfile($imgurl);
|
$currentTimestamp = strtotime(date('Y-m-d H:i:s'));
|
||||||
@flush(); @ob_flush();
|
// 如果当前时间已经超过了10点,则计算下一个10点的时间戳
|
||||||
exit();
|
if ($currentHour >= 10) {
|
||||||
}else{
|
$tenAMTimestamp = strtotime('+1 day 10:00:00');
|
||||||
exit('error');
|
}
|
||||||
|
$expiresSeconds = $tenAMTimestamp - $currentTimestamp;
|
||||||
|
$expires = gmdate('D, d M Y H:i:s', $currentTimestamp + $expiresSeconds) . ' GMT';
|
||||||
|
$lastModified = gmdate('D, d M Y H:i:s', $currentTimestamp) . ' GMT';
|
||||||
|
header('Last-Modified: ' . $lastModified);
|
||||||
|
header('Expires: ' . $expires);
|
||||||
|
header('Cache-Control: public, max-age=86400');
|
||||||
|
header('Content-Type: image/jpeg');
|
||||||
|
ob_clean();
|
||||||
|
readfile($imgurl);
|
||||||
|
flush();
|
||||||
|
exit();
|
||||||
|
} else {
|
||||||
|
// 如果 $imgurl 无效,输出错误信息
|
||||||
|
header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
|
||||||
|
header('Content-Type: text/plain');
|
||||||
|
echo 'Error: Invalid image URL.';
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
function get_curl($url)
|
||||||
|
{
|
||||||
|
$curl = curl_init();
|
||||||
|
curl_setopt_array($curl, array(
|
||||||
|
CURLOPT_URL => $url,
|
||||||
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
|
CURLOPT_FOLLOWLOCATION => true,
|
||||||
|
CURLOPT_ENCODING => '',
|
||||||
|
CURLOPT_MAXREDIRS => 10,
|
||||||
|
CURLOPT_TIMEOUT => 0,
|
||||||
|
CURLOPT_SSL_VERIFYPEER => false,
|
||||||
|
CURLOPT_SSL_VERIFYHOST => false,
|
||||||
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||||
|
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||||
|
CURLOPT_HTTPHEADER => array(
|
||||||
|
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36 Edg/101.0.1210.39 Lylme/11.24'
|
||||||
|
),
|
||||||
|
));
|
||||||
|
$contents = curl_exec($curl);
|
||||||
|
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
||||||
|
curl_close($curl);
|
||||||
|
if ($httpCode == 404) {
|
||||||
|
return $httpCode;
|
||||||
|
}
|
||||||
|
return $contents;
|
||||||
}
|
}
|
||||||
?>
|
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
header("Content-Type: text/html; charset=utf-8");
|
header("Content-Type: text/html; charset=utf-8");
|
||||||
|
|
||||||
$pass = ""; //在这里配置密钥
|
|
||||||
/*
|
/*
|
||||||
为保证安全,已禁止空密钥执行,请在 $pass 的引号内添加密钥
|
为保证安全,已禁止空密钥执行,请在 $pass 的引号内添加密钥
|
||||||
CRON任务:GET http://域名/assets/img/cron.php?key=设置的密钥
|
CRON任务:GET http://域名/assets/img/cron.php?key=设置的密钥
|
||||||
@ -11,113 +11,100 @@ $pass = 'lylme';
|
|||||||
CRON地址为:http://hao.lylme.com/assets/img/cron.php?key=lylme
|
CRON地址为:http://hao.lylme.com/assets/img/cron.php?key=lylme
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
$pass = ""; //在这里配置密钥
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//########以下内容可忽略########
|
//########以下内容可忽略########
|
||||||
|
if (empty($_GET['key'])) {
|
||||||
if(empty($pass)){
|
//未传入key
|
||||||
//密钥为空
|
exit('错误:密钥为空,请传入包含参数key的GET请求<br>
|
||||||
exit('错误:禁止空密钥执行CRON,请在cron.php文件配置密钥');
|
请求示例:<b>http://' . $_SERVER['HTTP_HOST'] . '/assets/img/cron.php?key=秘钥</b>');
|
||||||
|
} else if (empty($pass)) {
|
||||||
|
//密钥为空
|
||||||
|
exit('<b>错误:</b>未配置CRON密钥,请在cron.php文件配置密钥');
|
||||||
|
} else if ($pass != $_GET['key']) {
|
||||||
|
//密钥错误
|
||||||
|
exit('错误:传入参数key与密钥不匹配');
|
||||||
}
|
}
|
||||||
else if (empty($_GET['key'])) {
|
//密钥正确,执行下面代码
|
||||||
//未传入key
|
|
||||||
exit('错误:密钥为空,请传入包含参数key的GET请求<br>
|
|
||||||
请求示例:<b>http://'.$_SERVER['HTTP_HOST'].'/assets/img/cron.php?key=秘钥</b>');
|
|
||||||
}
|
|
||||||
else if($pass != $_GET['key']){
|
|
||||||
//密钥错误
|
|
||||||
exit('错误:传入参数key与密钥不匹配');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//密钥正确,执行下面代码
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PHP获取bing每日壁纸
|
|
||||||
* bing每日壁纸更新时间为UTC+8 16:00
|
|
||||||
*/
|
|
||||||
|
|
||||||
if($_GET['idx']==null){
|
if (empty($_GET['idx'])) {
|
||||||
$str=file_get_contents('http://cn.bing.com/HPImageArchive.aspx?idx=0&n=1');
|
$str = get_curl('http://cn.bing.com/HPImageArchive.aspx?idx=0&n=1');
|
||||||
//
|
} else {
|
||||||
|
$str = get_curl('http://cn.bing.com/HPImageArchive.aspx?idx=' . $_GET['idx'] . '&n=1');
|
||||||
}
|
|
||||||
else{
|
|
||||||
$str=file_get_contents('http://cn.bing.com/HPImageArchive.aspx?idx='.$_GET['idx'].'&n=1');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(preg_match("/<url>(.+?)<\/url>/is",$str,$matches)){
|
if (preg_match("/<url>(.+?)<\/url>/is", $str, $matches)) {
|
||||||
|
preg_match("/<fullstartdate>(.+?)<\/fullstartdate>/is", $str, $cdata);
|
||||||
if(preg_match("/<fullstartdate>(.+?)<\/fullstartdate>/is",$str,$cdata)){
|
$crdate = date('Y年m月d日 H:i', strtotime($cdata[1]));
|
||||||
|
$imgurl = 'http://cn.bing.com' . $matches[1];
|
||||||
|
echo "壁纸地址:" . $imgurl . "<br>";
|
||||||
|
echo "发布时间:" . $crdate . "<br>";
|
||||||
}
|
}
|
||||||
$crdate = date('Y年m月d日 H:i', strtotime($cdata[1]));
|
|
||||||
$imgurl = 'http://cn.bing.com'.$matches[1];
|
|
||||||
|
|
||||||
echo "壁纸地址:" . $imgurl."<br>";
|
|
||||||
echo "发布时间:" . $crdate."<br>";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将bing每日壁纸保存到 当前目录/background.jpg
|
* 将bing每日壁纸保存到 当前目录/background.jpg
|
||||||
*/
|
*/
|
||||||
function GrabImage($imgurl, $dir, $filename='/background.jpg'){
|
function GrabImage($imgurl, $dir, $filename = '/background.jpg')
|
||||||
if(empty($imgurl)){
|
{
|
||||||
|
if (empty($imgurl)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$ext = strrchr($imgurl, '.');
|
$ext = strrchr($imgurl, '.');
|
||||||
if($ext == '.js' && $ext == ".html" && $ext == ".php"){
|
if ($ext == '.js' && $ext == ".html" && $ext == ".php") {
|
||||||
echo "Format not supported!";
|
echo "Format not supported!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$dir = realpath($dir);
|
$dir = realpath($dir);
|
||||||
|
|
||||||
|
|
||||||
$filename = $dir . $filename;
|
$filename = $dir . $filename;
|
||||||
|
ob_start();
|
||||||
|
readfile($imgurl);
|
||||||
|
$img = ob_get_contents();
|
||||||
|
ob_end_clean();
|
||||||
|
$size = strlen($img);
|
||||||
|
|
||||||
ob_start();
|
$fp2 = fopen($filename, "w");
|
||||||
readfile($imgurl);
|
if (fwrite($fp2, $img) == true) {
|
||||||
$img = ob_get_contents();
|
echo "壁纸大小:" . round($size / 1024) . 'KB<br>';
|
||||||
ob_end_clean();
|
|
||||||
$size = strlen($img);
|
|
||||||
|
|
||||||
$fp2 = fopen($filename , "w");
|
|
||||||
if(fwrite($fp2, $img)==true){
|
|
||||||
echo "壁纸大小:" . round($size / 1024) .'KB<br>';
|
|
||||||
|
|
||||||
echo "<p><font color='green'>成功:当前壁纸已与Bing同步!</font></p>";
|
|
||||||
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
echo "<p><font color='red'>错误: 保存文件 <b>". $filename."</b> 失败,请检查目录权限</font></p>";
|
|
||||||
|
|
||||||
|
echo "<p><font color='green'>成功:当前壁纸已与Bing同步!</font></p>";
|
||||||
|
} else {
|
||||||
|
echo "<p><font color='red'>错误: 保存文件 <b>" . $filename . "</b> 失败,请检查目录权限</font></p>";
|
||||||
}
|
}
|
||||||
fclose($fp2);
|
fclose($fp2);
|
||||||
|
return $filename;
|
||||||
// echo "保存路径:" . $filename."<br>";
|
|
||||||
|
|
||||||
return $filename;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GrabImage($imgurl,dirname(__FILE__));
|
GrabImage($imgurl, dirname(__FILE__));
|
||||||
|
|
||||||
|
|
||||||
/**
|
function get_curl($url)
|
||||||
* 返回bing每日壁纸
|
{
|
||||||
*/
|
$curl = curl_init();
|
||||||
// if($imgurl){
|
curl_setopt_array($curl, array(
|
||||||
// header('Content-Type: image/JPEG');
|
CURLOPT_URL => $url,
|
||||||
// @ob_end_clean();
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
// @readfile($imgurl);
|
CURLOPT_FOLLOWLOCATION => true,
|
||||||
// @flush(); @ob_flush();
|
CURLOPT_ENCODING => '',
|
||||||
// exit();
|
CURLOPT_MAXREDIRS => 10,
|
||||||
// }else{
|
CURLOPT_TIMEOUT => 0,
|
||||||
// exit('error');
|
CURLOPT_SSL_VERIFYPEER => false,
|
||||||
// }
|
CURLOPT_SSL_VERIFYHOST => false,
|
||||||
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||||
|
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||||
|
CURLOPT_HTTPHEADER => array(
|
||||||
|
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36 Edg/101.0.1210.39 Lylme/11.24'
|
||||||
|
),
|
||||||
|
));
|
||||||
|
$contents = curl_exec($curl);
|
||||||
|
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
||||||
|
curl_close($curl);
|
||||||
|
if ($httpCode == 404) {
|
||||||
|
return $httpCode;
|
||||||
|
}
|
||||||
|
return $contents;
|
||||||
}
|
}
|
||||||
?>
|
|
7
assets/js/bootstrap.bundle.min.js
vendored
Normal file
7
assets/js/bootstrap.bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
assets/js/layui/css/layui.css
Normal file
1
assets/js/layui/css/layui.css
Normal file
File diff suppressed because one or more lines are too long
BIN
assets/js/layui/font/iconfont.eot
Normal file
BIN
assets/js/layui/font/iconfont.eot
Normal file
Binary file not shown.
405
assets/js/layui/font/iconfont.svg
Normal file
405
assets/js/layui/font/iconfont.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 322 KiB |
BIN
assets/js/layui/font/iconfont.ttf
Normal file
BIN
assets/js/layui/font/iconfont.ttf
Normal file
Binary file not shown.
BIN
assets/js/layui/font/iconfont.woff
Normal file
BIN
assets/js/layui/font/iconfont.woff
Normal file
Binary file not shown.
BIN
assets/js/layui/font/iconfont.woff2
Normal file
BIN
assets/js/layui/font/iconfont.woff2
Normal file
Binary file not shown.
1
assets/js/layui/layui.js
Normal file
1
assets/js/layui/layui.js
Normal file
File diff suppressed because one or more lines are too long
1
assets/js/sweetalert.min.js
vendored
Normal file
1
assets/js/sweetalert.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
10
assets/js/viewer.min.js
vendored
Normal file
10
assets/js/viewer.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user