diff --git a/class/core/config_api.py b/class/core/config_api.py index b311e396d..a7566863a 100755 --- a/class/core/config_api.py +++ b/class/core/config_api.py @@ -575,9 +575,17 @@ class config_api: cfg_domain = self.__file['bind_domain'] if domain == '': + + if os.path.exists(cfg_domain): + os.remove(cfg_domain) + + ip = mw.getLocalIp() + port = mw.readFile('data/port.pl').strip() + + to_panel_url = 'http://'+ip+":"+port+'/config' system_api.system_api().restartMw() - return mw.returnJson(True, '清空域名成功!') + return mw.returnJson(True, '清空域名成功!', to_panel_url) # panel_tpl = mw.getRunDir() + "/data/tpl/nginx_panel.conf" @@ -602,9 +610,12 @@ class config_api: # mw.writeFile(dst_panel_path, content) mw.writeFile(cfg_domain, domain) - + + port = mw.readFile('data/port.pl').strip() + to_panel_url = 'http://'+domain+":"+port+'/config' + system_api.system_api().restartMw() - return mw.returnJson(True, '设置域名成功!') + return mw.returnJson(True, '设置域名成功!',to_panel_url) # 设置面板SSL def setPanelSslApi(self): diff --git a/route/static/app/config.js b/route/static/app/config.js index ce2878da8..7a54eb980 100755 --- a/route/static/app/config.js +++ b/route/static/app/config.js @@ -75,7 +75,9 @@ $('input[name="bind_domain"]').change(function(){ $('.btn_bind_domain').removeAttr('disabled'); $('.btn_bind_domain').unbind().click(function(){ $.post('/config/set_panel_domain','domain='+domain, function(rdata){ - showMsg(rdata.msg,function(){window.location.reload();},{icon:rdata.status?1:2},2000); + showMsg(rdata.msg,function(){ + window.location.href = rdata.data; + },{icon:rdata.status?1:2},2000); },'json'); }); }); @@ -123,7 +125,7 @@ $('input[name="bind_ssl"]').click(function(){ \ ', yes: function(){ - + var cert_type = $('select[name=cert_type]').val(); if ( cert_type == 0 ){ $.post('/config/set_panel_local_ssl',{'cert_type':cert_type}, function(rdata){ @@ -136,7 +138,7 @@ $('input[name="bind_ssl"]').click(function(){ },{icon:rdata.status?1:2},5000); },'json'); } else if (cert_type == 1){ - + }