diff --git a/plugins/mail/js/mail.js b/plugins/mail/js/mail.js index 1d5a80231..bb71e599d 100755 --- a/plugins/mail/js/mail.js +++ b/plugins/mail/js/mail.js @@ -430,8 +430,49 @@ var mail = { $('#checkPostEnv tbody').append($(``+_this.post_env_text[index] +`${(res[item].status?"就绪":(res[item].msg !=''?(res[item].msg.toString().length>30?res[item].msg.toString().substring(0,30)+'...':res[item].msg.toString()):"异常"))}${(res[item].status?"无操作":"修复")}`)) } $('#checkPostEnv .divtable').removeClass('mtb10'); - callback && callback(); }); + }); + + $('#checkPostEnv').unbind().on('click','a',function(){ + var key = $(this).attr('data-keys'); + var confirmA = layer.confirm('是否修复邮局环境?', { + title: '修复邮局环境', + icon: 3, + closeBtn:2, + btn: ['确定', '取消'], + },function(index, layero){ + _this.repair_mail_env(key); + }); + }) + if(callback) callback() + }, + + //修复邮局环境 + repair_mail_env: function (key) { + var _this = this,_key; + switch(key) { + case 'Postfix-Version': + case 'Postfix-install': + case 'Sqlite-support': + _key = 'repair_postfix'; + break; + case 'Rspamd-install': + _key = 'install_rspamd'; + break; + case 'Dovecot-install': + _key = 'repair_dovecot'; + break; + } + + console.log(key,_key); + + this.send({ + tips: '正在修复' + key + ',请稍候...', + method: _key, + success: function (res) { + layer.msg(res.msg, { icon: res.status?1:2 }); + _this.create_post_env_table(); + } }) }, diff --git a/plugins/mail/mail_init.py b/plugins/mail/mail_init.py index a25b62150..413e71ae3 100644 --- a/plugins/mail/mail_init.py +++ b/plugins/mail/mail_init.py @@ -29,7 +29,7 @@ class mail_init: '/usr/sbin/dovecot') else {"status": False, "msg": "Dovecot未安装,请点击修复按钮"} data['Postfix-Version'] = self.check_postfix_ver() data['Redis-install'] = {"status": True, "msg": "Redis已经安装"} if os.path.exists( - '/www/server/redis/src/redis-server') else {"status": False, "msg": "请到软件商店内安装Redis"} + mw.getServerDir() + '/redis/bin/redis-server') else {"status": False, "msg": "请到软件商店内安装Redis"} data['Redis-Passwd'] = self.check_redis_passwd(data['Redis-install']) data['Rspamd-install'] = {"status": True, "msg": "Rspamd已经安装"} if os.path.exists( '/usr/bin/rspamd') else {"status": False, "msg": "Rspamd未安装,请点击修复按钮"} @@ -57,7 +57,7 @@ class mail_init: return mw.returnData(False, "当前版本不支持或Postfix没有安装成功:{}".format(postfix_version)) def check_redis_passwd(self, redis_install): - redis_conf = mw.readFile('/www/server/redis/redis.conf') + redis_conf = mw.readFile(mw.getServerDir() + '/redis/redis.conf') if redis_install['status']: if re.search('\n\s*requirepass', redis_conf): return mw.returnData(True, "Redis已经设置密码")