diff --git a/spug_api/apps/alarm/views.py b/spug_api/apps/alarm/views.py index f52694cf..c96d4df9 100644 --- a/spug_api/apps/alarm/views.py +++ b/spug_api/apps/alarm/views.py @@ -115,19 +115,10 @@ def handle_test(request): ).parse(request.body) if error is None: notify = Notification(None, '1', 'https://spug.cc', 'Spug官网(测试)', '这是一条测试告警信息', None) - if form.mode in ('1', '2', '4') and not notify.spug_key: - return json_response(error='未配置调用凭据(系统设置/基本设置),请配置后再尝试。') - - if form.mode == '1': - notify.monitor_by_wx([form.value]) - elif form.mode == '2': - return json_response(error='目前暂不支持短信告警,请关注后续更新。') - elif form.mode == '3': + if form.mode == '3': notify.monitor_by_dd([form.value]) elif form.mode == '4': notify.monitor_by_email([form.value]) elif form.mode == '5': notify.monitor_by_qy_wx([form.value]) - else: - return json_response(error='不支持的报警方式') return json_response(error=error) diff --git a/spug_api/apps/monitor/views.py b/spug_api/apps/monitor/views.py index e0f12df8..ff3e3e27 100644 --- a/spug_api/apps/monitor/views.py +++ b/spug_api/apps/monitor/views.py @@ -36,9 +36,9 @@ def post(self, request): Argument('notify_mode', type=list, help='请选择报警方式'), ).parse(request.body) if error is None: - if set(form.notify_mode).intersection(['1', '2', '4']): - if not AppSetting.get_default('spug_key') and not AppSetting.get_default('spug_push_key'): - return json_response(error='报警方式 微信、短信、邮件需要配置调用凭据(系统设置/基本设置)或推送服务(系统设置/推送服务设置),请配置后再启用该报警方式。') + if set(form.notify_mode).intersection(['1', '2', '6']): + if not AppSetting.get_default('spug_push_key'): + return json_response(error='报警方式微信、短信、电话需要配置推送服务(系统设置/推送服务设置),请配置后再启用该报警方式。') form.targets = json.dumps(form.targets) form.notify_grp = json.dumps(form.notify_grp) diff --git a/spug_web/src/pages/alarm/contact/Form.js b/spug_web/src/pages/alarm/contact/Form.js index ca83bebb..e76b964c 100644 --- a/spug_web/src/pages/alarm/contact/Form.js +++ b/spug_web/src/pages/alarm/contact/Form.js @@ -76,14 +76,6 @@ export default observer(function () { - 如何获取微信 Token ?}> - - - - - 钉钉收不到通知?请参考