加入部分消息通知入口,同步前端管理
This commit is contained in:
@@ -111,5 +111,58 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 推送设置 -->
|
||||
<div class="card" style="margin-bottom: 24px;">
|
||||
<div class="card-header">🔔 消息推送设置</div>
|
||||
<form method="POST" action="{{ url_for('save_config') }}">
|
||||
<div class="form-group">
|
||||
<label>Webhook 地址</label>
|
||||
<input type="text" name="webhook_url" value="{{ config.get('webhook_url', '') }}"
|
||||
placeholder="飞书/企业微信/钉钉机器人 Webhook URL" style="font-size:13px;">
|
||||
<div style="font-size:11px; color:#94a3b8; margin-top:4px;">支持飞书、企业微信、钉钉自定义机器人</div>
|
||||
</div>
|
||||
<div style="display:flex; gap:12px; align-items:flex-end;">
|
||||
<div class="form-group" style="flex:1;">
|
||||
<label>推送时间(时)</label>
|
||||
<select name="daily_report_hour">
|
||||
{% for h in range(24) %}
|
||||
<option value="{{ h }}" {{ 'selected' if config.get('daily_report_hour', '23')|string == h|string }}>{{ '%02d'|format(h) }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group" style="flex:1;">
|
||||
<label>推送时间(分)</label>
|
||||
<select name="daily_report_minute">
|
||||
{% for m in range(0, 60, 5) %}
|
||||
<option value="{{ m }}" {{ 'selected' if config.get('daily_report_minute', '30')|string == m|string }}>{{ '%02d'|format(m) }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display:flex; gap:8px; margin-top:8px;">
|
||||
<button type="submit" class="btn btn-primary" style="flex:1;">💾 保存配置</button>
|
||||
<button type="button" class="btn btn-secondary" onclick="testWebhook()" id="test-btn">📤 测试推送</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
async function testWebhook() {
|
||||
const btn = document.getElementById('test-btn');
|
||||
const url = document.querySelector('input[name="webhook_url"]').value.trim();
|
||||
if (!url) { alert('请先填写 Webhook 地址'); return; }
|
||||
btn.disabled = true; btn.textContent = '⏳ 发送中...';
|
||||
try {
|
||||
const form = new FormData();
|
||||
form.append('webhook_url', url);
|
||||
const resp = await fetch('{{ url_for("test_webhook") }}', {method: 'POST', body: form});
|
||||
const data = await resp.json();
|
||||
alert(data.success ? '✅ ' + data.message : '❌ ' + data.message);
|
||||
} catch(e) { alert('请求失败: ' + e.message); }
|
||||
btn.disabled = false; btn.textContent = '📤 测试推送';
|
||||
}
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user