From c43c18d36ce3aec80572bb77ce2fb6d34b227772 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Thu, 20 Dec 2018 13:39:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=99=E7=82=B9=E6=B7=BB=E5=8A=A0=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- class/core/site_api.py | 19 ++++++++++++++----- static/app/site.js | 22 +--------------------- 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/class/core/site_api.py b/class/core/site_api.py index 1e0949b53..1612cd8eb 100755 --- a/class/core/site_api.py +++ b/class/core/site_api.py @@ -252,7 +252,7 @@ class site_api: def nginxAddConf(self): source_tpl = public.getRunDir() + '/data/tpl/nginx.conf' - desc_file = self.setupPath + '/openresty/nginx/conf/vhost/' + self.siteName + '.conf' + vhost_file = self.setupPath + '/openresty/nginx/conf/vhost/' + self.siteName + '.conf' content = public.readFile(source_tpl) content = content.replace('{$PORT}', self.sitePort) @@ -265,7 +265,11 @@ class site_api: logsPath = public.getLogsDir() content = content.replace('{$LOGPATH}', logsPath) - public.writeFile(desc_file, content) + public.writeFile(vhost_file, content) + + rewrite_file = self.setupPath + \ + '/openresty/nginx/conf/rewrite/' + self.siteName + '.conf' + public.writeFile(rewrite_file, '') def add(self, webname, port, ps, path, version): @@ -312,9 +316,14 @@ class site_api: def delete(self, sid, webname): - confPath = self.setupPath + '/openresty/nginx/conf/vhost/' + webname + '.conf' - if os.path.exists(confPath): - os.remove(confPath) + confFile = self.setupPath + '/openresty/nginx/conf/vhost/' + webname + '.conf' + if os.path.exists(confFile): + os.remove(confFile) + + rewriteFile = self.setupPath + '/openresty/nginx/conf/rewrite/' + webname + '.conf' + if os.path.exists(rewriteFile): + os.remove(rewriteFile) + public.M('sites').where("id=?", (sid,)).delete() return public.returnJson(True, '站点删除成功!') diff --git a/static/app/site.js b/static/app/site.js index eb9be27af..b23c0ae5e 100755 --- a/static/app/site.js +++ b/static/app/site.js @@ -161,27 +161,7 @@ function webAdd(type) { if (ret.siteStatus == true) { getWeb(1); layer.closeAll(); - if(ftpData == '' && sqlData == ''){ - layer.msg(lan.site.success_txt,{icon:1}) - } else { - layer.open({ - type: 1, - area: '600px', - title: lan.site.success_txt, - closeBtn:2, - shadeClose: false, - content: "
\ -
\ -
\ - " + ftpData + sqlData + "\ -
\ -
", - }); - if ($(".success-msg").height() < 150) { - $(".success-msg").find("img").css({"width": "150px","margin-top": "30px"}); - } - } - + layer.msg('成功创建站点',{icon:1}) } else { layer.msg(ret.msg, {icon: 2}); }