v3.1 + 批次0: 智能回复重构基线 - ApprovalMatcher + 关键词降级 + 文档速修 + v4.0任务书面化

This commit is contained in:
Simon
2026-07-17 23:08:59 +08:00
parent 5a77a89ab1
commit 3ed86d5fb3
181 changed files with 19738 additions and 2655 deletions
+42 -28
View File
@@ -294,6 +294,7 @@ async def scan_qrcode(
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>登录成功 - IT智能服务台</title>
<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<style>
* {{ margin: 0; padding: 0; box-sizing: border-box; }}
body {{ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: linear-gradient(135deg, #07C160 0%, #06AD56 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }}
@@ -304,8 +305,6 @@ body {{ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
.status {{ display: inline-flex; align-items: center; gap: 6px; background: #dcfce7; color: #166534; padding: 10px 20px; border-radius: 50px; font-size: 14px; font-weight: 500; }}
.footer {{ margin-top: 20px; color: #9ca3af; font-size: 12px; }}
.back-btn {{ display: none; margin-top: 20px; padding: 12px 32px; background: #07C160; color: white; border: none; border-radius: 50px; font-size: 16px; font-weight: 500; cursor: pointer; }}
.debug {{ margin-top: 16px; color: #6b7280; font-size: 11px; line-height: 1.6; word-break: break-all; text-align: left; background: #f3f4f6; padding: 10px 12px; border-radius: 8px; }}
.debug b {{ color: #07C160; }}
</style>
</head>
<body>
@@ -319,22 +318,34 @@ body {{ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
<p class="subtitle">你好,{user_name}<br>请返回电脑端查看</p>
<button class="back-btn" id="backBtn" onclick="manualClose()">点击返回企微</button>
<div class="footer">页面即将自动关闭 · 税友集团</div>
<div class="debug" id="debugInfo">
<b>签名:</b> {'成功' if jsapi_signature else '未生成'}<br>
<b>URL:</b> {current_url}<br>
<b>状态:</b> <span id="jsStatus">JS加载中...</span>
</div>
</div>
<script>
(function() {{
var statusEl = document.getElementById('jsStatus');
var btnEl = document.getElementById('backBtn');
var startTime = Date.now();
var tried = {{}};
// 初始化企微 JS-SDK:注入后端生成的签名参数,使 wx.closeWindow() 生效
if (typeof wx !== 'undefined') {{
wx.config({{
beta: true,
debug: false,
appId: '{jsapi_appid}',
timestamp: {jsapi_timestamp},
nonceStr: '{jsapi_nonce}',
signature: '{jsapi_signature}',
jsApiList: ['closeWindow']
}});
wx.ready(function() {{
console.log('wx.config ready, closing window');
wx.closeWindow();
}});
wx.error(function(res) {{
console.error('wx.config error:', res);
// 降级到下方轮询检测逻辑
}});
}} else {{
console.warn('WeCom JS-SDK 未加载,使用降级关闭逻辑');
}}
function setStatus(msg) {{
if (statusEl) statusEl.textContent = msg + ' (' + (Date.now() - startTime) + 'ms)';
}}
(function() {{
var btnEl = document.getElementById('backBtn');
var tried = {{}};
function showBtn() {{
if (btnEl) btnEl.style.display = 'inline-block';
@@ -342,43 +353,43 @@ body {{ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
// 尝试关闭当前 WebView
function tryClose(forceShowBtn) {{
setStatus('尝试关闭');
console.log('尝试关闭');
// 1. 企微/微信 JS-SDK wx.closeWindow
if (!tried.wxClose && typeof wx !== 'undefined' && wx.closeWindow) {{
tried.wxClose = true;
try {{
setStatus('wx.closeWindow');
console.log('wx.closeWindow');
wx.closeWindow();
return true;
}} catch(e) {{ setStatus('wx.closeWindow失败:' + (e.message || e)); }}
}} catch(e) {{ console.log('wx.closeWindow失败:' + (e.message || e)); }}
}}
// 2. wx.invoke closeWindow
if (!tried.wxInvoke && typeof wx !== 'undefined' && wx.invoke) {{
tried.wxInvoke = true;
try {{
setStatus('wx.invoke closeWindow');
console.log('wx.invoke closeWindow');
wx.invoke('closeWindow', {{}}, function(){{}});
return true;
}} catch(e) {{ setStatus('wx.invoke失败:' + (e.message || e)); }}
}} catch(e) {{ console.log('wx.invoke失败:' + (e.message || e)); }}
}}
// 3. 内置 WeixinJSBridge
if (!tried.jsBridge && typeof WeixinJSBridge !== 'undefined' && WeixinJSBridge.call) {{
tried.jsBridge = true;
try {{
setStatus('WeixinJSBridge.closeWindow');
console.log('WeixinJSBridge.closeWindow');
WeixinJSBridge.call('closeWindow');
return true;
}} catch(e) {{ setStatus('JSBridge失败:' + (e.message || e)); }}
}} catch(e) {{ console.log('JSBridge失败:' + (e.message || e)); }}
}}
// 4. window.close
if (!tried.windowClose) {{
tried.windowClose = true;
try {{
setStatus('window.close');
console.log('window.close');
window.close();
return true;
}} catch(e) {{}}
@@ -388,14 +399,14 @@ body {{ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
if (!tried.historyBack) {{
tried.historyBack = true;
try {{
setStatus('history.back');
console.log('history.back');
history.back();
return true;
}} catch(e) {{}}
}}
if (forceShowBtn) {{
setStatus('无法自动关闭,请手动返回');
console.log('无法自动关闭,请手动返回');
showBtn();
}}
return false;
@@ -405,6 +416,9 @@ body {{ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
tryClose(true);
}}
// 暴露到全局,供按钮 onclick 调用
window.manualClose = manualClose;
// 轮询检测 WeixinJSBridge / wx,最多 5 秒
var checkCount = 0;
var maxChecks = 50;
@@ -412,11 +426,11 @@ body {{ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
checkCount++;
var hasWx = typeof wx !== 'undefined';
var hasBridge = typeof WeixinJSBridge !== 'undefined';
setStatus('检测中 wx=' + hasWx + ' bridge=' + hasBridge + ' count=' + checkCount);
console.log('检测中 wx=' + hasWx + ' bridge=' + hasBridge + ' count=' + checkCount);
if (hasWx || hasBridge) {{
clearInterval(interval);
setStatus('已检测到关闭API1秒后尝试关闭');
console.log('已检测到关闭API1秒后尝试关闭');
setTimeout(function() {{
tryClose(true);
}}, 1000);
@@ -425,7 +439,7 @@ body {{ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
if (checkCount >= maxChecks) {{
clearInterval(interval);
setStatus('未检测到API,直接尝试关闭');
console.log('未检测到API,直接尝试关闭');
tryClose(true);
}}
}}, 100);