mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 04:59:25 +08:00
up
This commit is contained in:
@@ -1,22 +1,17 @@
|
||||
from flask import Flask
|
||||
# from flask import Blueprint,render_template
|
||||
from views import dashboard
|
||||
from views import site
|
||||
from views import files
|
||||
from views import soft
|
||||
from views import config
|
||||
from views import plugins
|
||||
import views
|
||||
|
||||
app = Flask(__name__)
|
||||
app.debug = True
|
||||
|
||||
DEFAULT_MODULES = (
|
||||
(dashboard, "/"),
|
||||
(site, "/site"),
|
||||
(files, "/files"),
|
||||
(soft, "/soft"),
|
||||
(config, "/config"),
|
||||
(plugins, "/plugins"),
|
||||
(views.dashboard, "/"),
|
||||
(views.site, "/site"),
|
||||
(views.files, "/files"),
|
||||
(views.soft, "/soft"),
|
||||
(views.config, "/config"),
|
||||
(views.plugins, "/plugins"),
|
||||
(views.task, "/task"),
|
||||
)
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -936,7 +936,7 @@ function GetTaskList(a) {
|
||||
}
|
||||
|
||||
function GetTaskCount() {
|
||||
$.post("/ajax?action=GetTaskCount", "", function(a) {
|
||||
$.get("/task/count", "", function(a) {
|
||||
$(".task").text(a)
|
||||
})
|
||||
}
|
||||
|
||||
+4
-206
@@ -194,7 +194,7 @@ function service(name, status) {
|
||||
|
||||
//更新软件列表
|
||||
function updateSoftList() {
|
||||
$.get('/plugin?action=getCloudPlugin', function(rdata) {});
|
||||
$.get('/plugins/list?action=getCloudPlugin', function(rdata) {});
|
||||
}
|
||||
|
||||
//php上传限制
|
||||
@@ -1810,7 +1810,9 @@ function GetSList(isdisplay) {
|
||||
setCookie('p' + getCookie('softType'), isdisplay);
|
||||
}
|
||||
|
||||
$.post('/plugin?action=getPluginList&tojs=GetSList' + search + type + page, '', function(rdata) {
|
||||
console.log("1212");
|
||||
|
||||
$.post('/plugins/list&tojs=GetSList' + search + type + page, '', function(rdata) {
|
||||
layer.close(loadT);
|
||||
var tBody = '';
|
||||
var sBody = '';
|
||||
@@ -2182,197 +2184,7 @@ function get_plugin_coupon(pid) {
|
||||
}
|
||||
})
|
||||
}
|
||||
//取专业版代金券
|
||||
function get_pro_coupon() {
|
||||
$("#couponlist").html("<div class='cloading'>加载中,请稍后</div>");
|
||||
$.get("/auth?action=get_voucher", function(rdata) {
|
||||
if (rdata != null) {
|
||||
var con = '';
|
||||
var len = rdata.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (rdata[i].status != 1) {
|
||||
var cyc = rdata[i].cycle + conver_unit(rdata[i].unit);
|
||||
if (rdata[i].cycle == 999) {
|
||||
cyc = "永久"
|
||||
}
|
||||
con += '<li class="pay-cycle-btn" data-code="' + rdata[i].code + '"><span>' + cyc + '</span></li>';
|
||||
}
|
||||
}
|
||||
$("#couponlist").html('<ul class="pay-btn-group">' + con + '</ul>');
|
||||
$(".pay-btn-group > li").click(function() {
|
||||
$(this).addClass("active").siblings().removeClass("active");
|
||||
$(".paymethod-submit button").css({ "background-color": "#20a53a", "border-color": "#20a53a" });
|
||||
});
|
||||
$(".paymethod-submit button").click(function() {
|
||||
var code = $("#couponlist .pay-btn-group .active").attr("data-code");
|
||||
if (code == undefined) {
|
||||
layer.msg("请选择代金券");
|
||||
} else {
|
||||
useCoupon(code);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
$("#couponlist").html("<p class='text-center' style='margin-top:70px'>暂无代金券</p>");
|
||||
}
|
||||
})
|
||||
}
|
||||
//插件代金券续费
|
||||
function useCoupon_plugin(code, pid) {
|
||||
var loadT = layer.msg("提交中,请稍后。", { icon: 16, time: 0, shade: [0.3, "#000"] });
|
||||
$.post("/auth?action=create_order_voucher_plugin", { pid: pid, code: code }, function(rdata) {
|
||||
layer.closeAll();
|
||||
layer.msg(rdata.msg);
|
||||
})
|
||||
}
|
||||
//专业版代金券续费
|
||||
function useCoupon(code) {
|
||||
var loadT = layer.msg("提交中,请稍后。", { icon: 16, time: 0, shade: [0.3, "#000"] });
|
||||
$.post("/auth?action=create_order_voucher", { code: code }, function(rdata) {
|
||||
layer.closeAll();
|
||||
layer.msg(rdata.msg);
|
||||
if (rdata.status === true) {
|
||||
layer.msg("支付成功!专业版升级中,请勿操作!", { icon: 16, time: 0, shade: [0.3, "#000"] });
|
||||
$.get("/system?action=UpdatePro", function(rr) {
|
||||
show_upVip();
|
||||
}).error(function() {
|
||||
show_upVip();
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function show_upVip() {
|
||||
layer.closeAll();
|
||||
layer.msg("恭喜您,升级完成!", { icon: 1 });
|
||||
setTimeout(function() { window.location.href = '/'; }, 3000);
|
||||
}
|
||||
|
||||
//取专业版产品折扣信息
|
||||
function get_product_discount() {
|
||||
var con = '<div class="libPay-item f14 plr15">\
|
||||
<div class="li-tit c4">付款方式</div>\
|
||||
<div class="li-con c6" id="Payment"><ul class="pay-btn-group pay-cycle"><li class="pay-cycle-btn active"><span>微信支付</span></li><li class="pay-cycle-btn" onclick="get_pro_coupon()"><span>代金券</span></li></ul></div>\
|
||||
</div>\
|
||||
<div class="payment-con">\
|
||||
<div class="pay-weixin">\
|
||||
<div class="libPay-item f14 plr15">\
|
||||
<div class="li-tit c4">开通时长</div>\
|
||||
<div class="li-con c6" id="PayCycle"></div>\
|
||||
</div>\
|
||||
<div class="lib-price-box text-center"><span class="lib-price-name f14"><b>总计</b></span><span class="price-txt"><b class="sale-price"></b>元</span><s class="cost-price"></s></div>\
|
||||
<div class="paymethod">\
|
||||
<div class="pay-wx"></div>\
|
||||
<div class="pay-wx-info f16 text-center"><span class="wx-pay-ico mr5"></span>微信扫码支付</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="pay-coupon" style="display:none">\
|
||||
<div class="libPay-item f14 plr15" style="height:200px;overflow:auto">\
|
||||
<div class="li-tit c4 ">代金券列表</div>\
|
||||
<div class="li-con c6" id="couponlist"><div class="btn-group"></div></div>\
|
||||
</div>\
|
||||
<div class="paymethod-submit text-center">\
|
||||
<button class="btn btn-success btn-sm f16" style="width:200px;height:40px;background-color:#999;border-color:#888">提交</button>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>'
|
||||
$(".libpay-con").html("<div class='cloading'>加载中,请稍后</div>");
|
||||
$.get("/auth?action=get_product_discount_by", function(rdata) {
|
||||
if (rdata != null) {
|
||||
var coucon = '';
|
||||
var qarr = Object.keys(rdata);
|
||||
var qlen = qarr.length;
|
||||
//折扣列表
|
||||
for (var i = 0; i < qlen; i++) {
|
||||
var j = qarr[i];
|
||||
var a = rdata[j].price;
|
||||
var b = rdata[j].sprice;
|
||||
var c = rdata[j].discount;
|
||||
coucon += '<li class="pay-cycle-btn" onclick="getRsCodePro(' + a + ',' + b + ',' + j + ')"><span>' + conver_unit(j) + '</span>' + (c == 1 ? "" : '<em>' + c * 10 + '折</em>') + '</li>';
|
||||
}
|
||||
$(".libpay-con").html(con);
|
||||
$("#PayCycle").html('<ul class="pay-btn-group">' + coucon + '</ul>');
|
||||
$(".pay-btn-group li").click(function() {
|
||||
$(this).addClass("active").siblings().removeClass("active");
|
||||
});
|
||||
$(".pay-cycle li").click(function() {
|
||||
var i = $(this).index();
|
||||
$(this).addClass("active").siblings().removeClass("active");
|
||||
$(".payment-con > div").eq(i).show().siblings().hide();
|
||||
});
|
||||
$("#PayCycle .pay-btn-group li").eq(0).click();
|
||||
}
|
||||
})
|
||||
}
|
||||
//单位转换
|
||||
function conver_unit(name) {
|
||||
var unit = '';
|
||||
switch (name) {
|
||||
case "year":
|
||||
unit = "年";
|
||||
break;
|
||||
case "month":
|
||||
unit = "个月";
|
||||
break;
|
||||
case "day":
|
||||
unit = "天";
|
||||
break;
|
||||
case "1":
|
||||
unit = "1个月";
|
||||
break;
|
||||
case "3":
|
||||
unit = "3个月";
|
||||
break;
|
||||
case "6":
|
||||
unit = "6个月";
|
||||
break;
|
||||
case "12":
|
||||
unit = "1年";
|
||||
break;
|
||||
case "24":
|
||||
unit = "2年";
|
||||
break;
|
||||
case "36":
|
||||
unit = "3年";
|
||||
break;
|
||||
case "999":
|
||||
unit = "永久";
|
||||
break;
|
||||
}
|
||||
return unit;
|
||||
}
|
||||
var wxpayTimeId = 0;
|
||||
|
||||
function getRsCode(pid, price, sprice, cycle) {
|
||||
$(".sale-price").text(price);
|
||||
if (price == sprice) {
|
||||
$(".cost-price").text(sprice + '元').hide();
|
||||
} else {
|
||||
$(".cost-price").text(sprice + '元').show();
|
||||
}
|
||||
$(".pay-wx").html('<span class="loading">加载中,请稍后</span>');
|
||||
$(".libPay").append('<div class="payloadingmask" style="height:100%;width:100%;position:absolute;top:0;left:0;z-index:9;background:#fff;opacity:0"></div>');
|
||||
$.post('/auth?action=get_buy_code', { pid: pid, cycle: cycle }, function(rdata) {
|
||||
$(".payloadingmask").remove();
|
||||
if (rdata.status === false) {
|
||||
layer.msg(rdata.msg, { icon: 2 });
|
||||
return;
|
||||
}
|
||||
$(".pay-wx").html('');
|
||||
$(".pay-wx").qrcode(rdata.msg);
|
||||
clearInterval(wxpayTimeId);
|
||||
wxpayTimeId = setInterval(function() {
|
||||
$.post('/auth?action=check_pay_status', { id: pid }, function(rdata) {
|
||||
if (rdata.status) {
|
||||
layer.closeAll();
|
||||
layer.msg('支付成功!', { icon: 1 });
|
||||
clearInterval(wxpayTimeId);
|
||||
return;
|
||||
}
|
||||
})
|
||||
}, 3000);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function getRsCodePro(price, sprice, cycle) {
|
||||
$(".sale-price").text(price);
|
||||
@@ -2416,20 +2228,6 @@ function anTo(pluginName, pid) {
|
||||
Renewinstall(pluginName, pid, 1);
|
||||
}
|
||||
|
||||
//登陆宝塔官网帐户
|
||||
function loginBT(pluginName, pid) {
|
||||
p1 = $("#p1").val();
|
||||
p2 = $("#p2").val();
|
||||
var loadT = layer.msg(lan.config.token_get, { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.post("/ssl?action=GetToken", "username=" + p1 + "&password=" + p2, function(b) {
|
||||
layer.close(loadT);
|
||||
layer.msg(b.msg, { icon: b.status ? 1 : 2 });
|
||||
if (b.status) {
|
||||
layer.closeAll();
|
||||
Renewinstall(pluginName, pid);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//独立安装
|
||||
function oneInstall(name, version) {
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<span typeid="3">插件</span> -->
|
||||
</div>
|
||||
|
||||
<button class="btn btn-default btn-sm" onclick="flush_cache()" title="添加插件" style="position:absolute;top:12px;right:15px">添加插件</button>
|
||||
<button class="btn btn-default btn-sm" onclick="flush_cache()" title="从云端更新列表" style="position:absolute;top:12px;right:15px">添加插件</button>
|
||||
<div id="updata_pro_info"></div>
|
||||
<table class="table table-hover" width="100%" cellspacing="0" cellpadding="0" border="0">
|
||||
<thead>
|
||||
@@ -57,11 +57,11 @@
|
||||
<script type="text/javascript" src="/static/js/soft.js?date=20180815"></script>
|
||||
<script type="text/javascript" src="/static/laydate/laydate.js?date=20180301"></script>
|
||||
<script>
|
||||
// setCookie('serverType','$web.ctx.session.webserver');
|
||||
setCookie('serverType','$web.ctx.session.webserver');
|
||||
//取软件列表
|
||||
GetSList();
|
||||
$$.get("/ajax?action=GetCloudHtml&rpath=btpanel_message/updata_pro.html",function(rdata){
|
||||
$$("#updata_pro_info").html(rdata);
|
||||
});
|
||||
// $$.get("/ajax?action=GetCloudHtml&rpath=btpanel_message/updata_pro.html",function(rdata){
|
||||
// $$("#updata_pro_info").html(rdata);
|
||||
// });
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -6,3 +6,4 @@ from files import *
|
||||
from soft import *
|
||||
from config import *
|
||||
from plugins import *
|
||||
from task import *
|
||||
|
||||
+28
-26
@@ -1,40 +1,42 @@
|
||||
# coding:utf-8
|
||||
|
||||
from flask import Flask
|
||||
from flask import Blueprint,render_template
|
||||
from flask import Blueprint, render_template
|
||||
from flask import jsonify
|
||||
import psutil,time
|
||||
|
||||
import psutil
|
||||
import time
|
||||
|
||||
|
||||
dashboard = Blueprint('dashboard', __name__, template_folder='templates')
|
||||
|
||||
|
||||
@dashboard.route("/")
|
||||
def index():
|
||||
return render_template('default/index.html')
|
||||
|
||||
|
||||
@dashboard.route("getnetwork")
|
||||
def getNetWork():
|
||||
#取网络流量信息
|
||||
networkIo = psutil.net_io_counters()[:4]
|
||||
# if not hasattr(web.ctx.session,'otime'):
|
||||
# web.ctx.session.up = networkIo[0]
|
||||
# web.ctx.session.down = networkIo[1]
|
||||
# web.ctx.session.otime = time.time();
|
||||
|
||||
ntime = time.time();
|
||||
networkInfo = {}
|
||||
networkInfo['upTotal'] = networkIo[0]
|
||||
networkInfo['downTotal'] = networkIo[1]
|
||||
# networkInfo['up'] = round(float(networkIo[0] - web.ctx.session.up) / 1024 / (ntime - web.ctx.session.otime),2)
|
||||
# networkInfo['down'] = round(float(networkIo[1] - web.ctx.session.down) / 1024 / (ntime - web.ctx.session.otime),2)
|
||||
networkInfo['downPackets'] =networkIo[3]
|
||||
networkInfo['upPackets'] =networkIo[2]
|
||||
|
||||
# web.ctx.session.up = networkIo[0]
|
||||
# web.ctx.session.down = networkIo[1]
|
||||
# web.ctx.session.otime = ntime;
|
||||
|
||||
# networkInfo['cpu'] = self.GetCpuInfo()
|
||||
# networkInfo['load'] = self.GetLoadAverage(get);
|
||||
return jsonify(networkInfo)
|
||||
# 取网络流量信息
|
||||
networkIo = psutil.net_io_counters()[:4]
|
||||
# if not hasattr(web.ctx.session,'otime'):
|
||||
# web.ctx.session.up = networkIo[0]
|
||||
# web.ctx.session.down = networkIo[1]
|
||||
# web.ctx.session.otime = time.time();
|
||||
|
||||
ntime = time.time()
|
||||
networkInfo = {}
|
||||
networkInfo['upTotal'] = networkIo[0]
|
||||
networkInfo['downTotal'] = networkIo[1]
|
||||
# networkInfo['up'] = round(float(networkIo[0] - web.ctx.session.up) / 1024 / (ntime - web.ctx.session.otime),2)
|
||||
# networkInfo['down'] = round(float(networkIo[1] - web.ctx.session.down) / 1024 / (ntime - web.ctx.session.otime),2)
|
||||
networkInfo['downPackets'] = networkIo[3]
|
||||
networkInfo['upPackets'] = networkIo[2]
|
||||
|
||||
# web.ctx.session.up = networkIo[0]
|
||||
# web.ctx.session.down = networkIo[1]
|
||||
# web.ctx.session.otime = ntime;
|
||||
|
||||
# networkInfo['cpu'] = self.GetCpuInfo()
|
||||
# networkInfo['load'] = self.GetLoadAverage(get);
|
||||
return jsonify(networkInfo)
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
# coding:utf-8
|
||||
|
||||
from flask import Blueprint, render_template
|
||||
from flask import jsonify
|
||||
|
||||
plugins = Blueprint('plugins', __name__, template_folder='templates')
|
||||
|
||||
@@ -12,4 +13,4 @@ def index():
|
||||
|
||||
@plugins.route("/list")
|
||||
def list():
|
||||
pass
|
||||
return jsonify({"ss": 3})
|
||||
|
||||
@@ -10,3 +10,8 @@ task = Blueprint('task', __name__, template_folder='templates')
|
||||
@task.route("/")
|
||||
def index():
|
||||
return render_template('default/site.html')
|
||||
|
||||
|
||||
@task.route("/count")
|
||||
def count():
|
||||
return "0"
|
||||
|
||||
Reference in New Issue
Block a user