From 6978b7a4218ba895f4156fc3065798680d058ee4 Mon Sep 17 00:00:00 2001 From: midoks Date: Sun, 7 Oct 2018 17:42:46 +0800 Subject: [PATCH] u --- plugins/beta/info.json | 3 +- plugins/btyw/info.json | 3 +- plugins/deployment/info.json | 3 +- plugins/phpguard/info.json | 3 +- plugins/safelogin/info.json | 3 +- plugins/score/info.json | 3 +- plugins/vpn/info.json | 9 +- static/js/soft.js | 222 +---------------------------------- templates/default/soft.html | 2 +- views/plugins.py | 15 ++- 10 files changed, 31 insertions(+), 235 deletions(-) diff --git a/plugins/beta/info.json b/plugins/beta/info.json index 83de6b84a..1ccec7589 100755 --- a/plugins/beta/info.json +++ b/plugins/beta/info.json @@ -11,5 +11,6 @@ "home":"http://www.bt.cn/bbs", "date":"2017-10-16", "default":false, - "display":0 + "display":0, + "pid":"2" } \ No newline at end of file diff --git a/plugins/btyw/info.json b/plugins/btyw/info.json index 70f1db2e6..b2aa9fe3e 100755 --- a/plugins/btyw/info.json +++ b/plugins/btyw/info.json @@ -14,5 +14,6 @@ "home":"https://www.bt.cn/yunwei", "date":"2017-10-18", "default":false, - "display":0 + "display":0, + "pid":"2" } \ No newline at end of file diff --git a/plugins/deployment/info.json b/plugins/deployment/info.json index b8261af1c..c03c2fc85 100755 --- a/plugins/deployment/info.json +++ b/plugins/deployment/info.json @@ -11,5 +11,6 @@ "home":"http://www.bt.cn/bbs", "date":"2017-07-26", "default":false, - "display":0 + "display":1, + "pid":"2" } \ No newline at end of file diff --git a/plugins/phpguard/info.json b/plugins/phpguard/info.json index d65321ce3..8930941e4 100755 --- a/plugins/phpguard/info.json +++ b/plugins/phpguard/info.json @@ -11,5 +11,6 @@ "home":"http://www.bt.cn/bbs", "date":"2017-10-16", "default":false, - "display":0 + "display":0, + "pid":"2" } \ No newline at end of file diff --git a/plugins/safelogin/info.json b/plugins/safelogin/info.json index bb881a2eb..3fe4c2b42 100755 --- a/plugins/safelogin/info.json +++ b/plugins/safelogin/info.json @@ -11,5 +11,6 @@ "home":"http://www.bt.cn/bbs", "date":"2017-11-24", "default":false, - "display":0 + "display":0, + "pid":"3" } \ No newline at end of file diff --git a/plugins/score/info.json b/plugins/score/info.json index 59fda758e..68b610495 100755 --- a/plugins/score/info.json +++ b/plugins/score/info.json @@ -11,5 +11,6 @@ "home":"http://www.bt.cn/bbs", "date":"2017-10-16", "default":false, - "display":0 + "display":0, + "pid":"2" } \ No newline at end of file diff --git a/plugins/vpn/info.json b/plugins/vpn/info.json index 96884603d..4795da8d7 100755 --- a/plugins/vpn/info.json +++ b/plugins/vpn/info.json @@ -4,12 +4,13 @@ "name":"VPN", "type":"其他插件", "ps":"科学上网", - "versions":"1.3", + "versions":"0.1", "shell":"install.sh", "checks":"/www/server/panel/plugin/safelogin", - "author":"宝塔", + "author":"midoks", "home":"http://www.bt.cn/bbs", "date":"2017-11-24", - "default":false, - "display":0 + "default":true, + "display":1, + "pid": "3" } \ No newline at end of file diff --git a/static/js/soft.js b/static/js/soft.js index fdfe93643..e585fa90b 100755 --- a/static/js/soft.js +++ b/static/js/soft.js @@ -192,11 +192,6 @@ function service(name, status) { } -//更新软件列表 -function updateSoftList() { - $.get('/plugins/list?action=getCloudPlugin', function(rdata) {}); -} - //php上传限制 function phpUploadLimit(version, max) { var LimitCon = '

MB

'; @@ -1785,8 +1780,8 @@ function GetSList(isdisplay) { $("#softPage").html(rdata.page); $("#softPage .Pcount").css({ "position": "absolute", "left": "0" }) - $(".task").text(rdata.data[rdata.length - 1]); - for (var i = 0; i < rdata.data.length - 1; i++) { + $(".task").text(rdata.data[rdata.data.length - 1]); + for (var i = 0; i < rdata.data.length; i++) { var len = rdata.data[i].versions.length; var version_info = ''; var version = ''; @@ -1947,215 +1942,6 @@ function SoftUpdate(name, version, update) { }); }, msg); } -//续费 -function Renewinstall(pluginName, pid, an) { - if (an === undefined) { - var txt = "开通"; - } else { - var txt = "续费"; - } - var payhtml = '
\ -
\ -
类型
\ -
\ -
    \ -
  • ' + pluginName + '1款插件
  • \ -
  • 升级为专业版所有插件免费使用
  • \ -
\ - \ -
\ -
\ -
\ -
\ -
'; - layer.open({ - type: 1, - title: txt + pluginName, - area: ['616px', '680px'], - closeBtn: 2, - shadeClose: false, - content: payhtml - }); - get_plugin_price(pluginName, pid, 1); - $(".li-c-item li").click(function() { - var i = $(this).index(); - $(this).addClass("active").siblings().removeClass("active"); - if (i == 0) { - get_plugin_price(pluginName, pid, 1); - $(".pro-info").hide(); - } else { - get_product_discount(); - $(".pro-info").show(); - } - }); - $(".pay-btn-group > li").click(function() { - $(this).addClass("active").siblings().removeClass("active"); - }); -} -//升级为专业版 -function updatapro() { - var payhtml = '
\ -
\ -
\ -

注:如需购买多台永久授权,请登录宝塔官网购买。去宝塔官网

\ -
'; - layer.open({ - type: 1, - title: '升级专业版,所有插件,免费使用', - area: ['616px', '540px'], - closeBtn: 2, - shadeClose: false, - content: payhtml - }); - get_product_discount(); - $(".pay-btn-group > li").click(function() { - $(this).addClass("active").siblings().removeClass("active"); - }); -} - -//取插件折扣信息 -function get_plugin_price(pluginName, pid, an) { - var con = '
\ -
付款方式
\ -
  • 微信支付
  • 代金券
\ -
\ -
\ -
\ -
\ -
开通时长
\ -
\ -
\ -
总计元
\ -
\ -
\ -
微信扫码支付
\ -
\ -
\ - \ -
' - $(".libpay-con").html("
加载中,请稍后
"); - $.post('/auth?action=get_plugin_price', { pluginName: pluginName }, function(rdata) { - - if (rdata.status === false) { - //未绑定 - var payhtml = '

绑定宝塔官网账号

未有账号,去注册

'; - $(".libPay-select").hide(); - $(".libpay-con").html(payhtml); - } else if (an === undefined) { - //同意协议 - var payhtml = '
注意:您购买的插件只在当前服务器有效。
本插件为特价期间,可能存在一定的稳定性问题。
有任何问题,欢迎咨询QQ394030111反馈。
'; - $(".libPay-select").hide(); - $(".libpay-con").html(payhtml); - var imin = 6; - var timehwnd = setInterval(function countdown() { - imin--; - var applyObj = $("#apply-ps"); - if (imin == 0) { - applyObj.prop("value", "同意"); - applyObj.removeAttr("disabled"); - applyObj.attr("onclick", "anTo('" + pluginName + "','" + pid + "')"); - applyObj.removeAttr("style"); - clearInterval(timehwnd); - } else { - applyObj.prop("value", "同意(" + imin + ")"); - } - }, 1000); - } else { - $(".libPay-select").show(); - $(".libpay-con").html(con); - $("#PayCycle .btn-group").html(rdata); - $(".pay-cycle li").click(function() { - var i = $(this).index(); - $(this).addClass("active").siblings().removeClass("active"); - $(".payment-con > div").eq(i).show().siblings().hide(); - }); - $(".btn-group .btn-success").click(); - $(".btn-group .btn").click(function() { - $(this).addClass("btn-success").siblings().removeClass("btn-success"); - }); - } - }) -} - -//取插件优惠券 -function get_plugin_coupon(pid) { - var con = ''; - $("#couponlist").html("
加载中,请稍后
"); - $.post('/auth?action=get_voucher_plugin', { pid: pid }, function(rdata) { - if (rdata != '') { - for (var i = 0, l = rdata.length; i < l; i++) { - con += '
  • ' + rdata[i].cycle + conver_unit(rdata[i].unit) + '
  • '; - } - $("#couponlist").html(''); - $(".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_plugin(code, pid); - } - }) - } else { - $("#couponlist").html("

    暂无代金券

    "); - } - }) -} - - -function getRsCodePro(price, sprice, cycle) { - $(".sale-price").text(price); - if (price == sprice) { - $(".cost-price").text(sprice + '元').hide(); - } else { - $(".cost-price").text(sprice + '元').show(); - } - $(".pay-wx").html('加载中,请稍后'); - $(".libPay").append('
    '); - $.post('/auth?action=create_order', { 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=get_re_order_status', function(rdata) { - if (rdata.status) { - layer.closeAll(); - layer.msg("支付成功!专业版升级中,请勿操作!", { icon: 16, time: 0, shade: [0.3, "#000"] }); - clearInterval(wxpayTimeId); - $.get("/system?action=UpdatePro", function(rr) { - show_upVip(); - }).error(function() { - show_upVip(); - }); - return; - } - }) - }, 3000); - - }); -} - -function anTo(pluginName, pid) { - layer.closeAll(); - Renewinstall(pluginName, pid, 1); -} - //独立安装 function oneInstall(name, version) { @@ -2555,6 +2341,4 @@ $(function() { if (window.document.location.pathname == '/soft') { setInterval(function() { GetSList(true); }, 5000); } -}); - -updateSoftList(); \ No newline at end of file +}); \ No newline at end of file diff --git a/templates/default/soft.html b/templates/default/soft.html index d6daa3901..f101d52f8 100755 --- a/templates/default/soft.html +++ b/templates/default/soft.html @@ -22,7 +22,7 @@ - +
    diff --git a/views/plugins.py b/views/plugins.py index 2181c66ca..ae7ebcad2 100644 --- a/views/plugins.py +++ b/views/plugins.py @@ -34,7 +34,9 @@ def list(): plugins_info = [] - print request.args['type'] + typeVal = request.args.get('type', '') + if typeVal == "": + typeVal = "0" for dirinfo in os.listdir(__plugin_name): path = __plugin_name + "/" + dirinfo @@ -43,10 +45,13 @@ def list(): if os.path.exists(jsonFile): try: tmp = json.loads(public.readFile(jsonFile)) - plugins_info.append(tmp) - # print tmp - except: + if typeVal == "0": + plugins_info.append(tmp) + else: + if tmp['pid'] == typeVal: + plugins_info.append(tmp) + except ValueError, Argument: pass - # print dirinfo + ret['data'] = plugins_info return jsonify(ret)