| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497 | 
							- <!DOCTYPE html>
 
- <html lang="zh-CN">
 
- <head>
 
-   <meta charset="UTF-8">
 
-   <meta name="viewport" content="width=device-width, initial-scale=1.0">
 
-   <title>会话激活测试地址获取工具</title>
 
-   <style>
 
-     * {
 
-       margin: 0;
 
-       padding: 0;
 
-       box-sizing: border-box;
 
-     }
 
-     
 
-     body {
 
-       font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
 
-       background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
 
-       min-height: 100vh;
 
-       display: flex;
 
-       align-items: center;
 
-       justify-content: center;
 
-       padding: 20px;
 
-     }
 
-     
 
-     .container {
 
-       background: white;
 
-       border-radius: 20px;
 
-       box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
 
-       max-width: 800px;
 
-       width: 100%;
 
-       padding: 40px;
 
-     }
 
-     
 
-     h1 {
 
-       color: #333;
 
-       margin-bottom: 10px;
 
-       font-size: 28px;
 
-     }
 
-     
 
-     .subtitle {
 
-       color: #666;
 
-       margin-bottom: 30px;
 
-       font-size: 14px;
 
-     }
 
-     
 
-     .info-box {
 
-       background: #f8f9fa;
 
-       border-left: 4px solid #667eea;
 
-       padding: 15px;
 
-       margin-bottom: 20px;
 
-       border-radius: 4px;
 
-     }
 
-     
 
-     .info-box h3 {
 
-       color: #667eea;
 
-       margin-bottom: 10px;
 
-       font-size: 16px;
 
-     }
 
-     
 
-     .info-box code {
 
-       background: #e9ecef;
 
-       padding: 2px 6px;
 
-       border-radius: 3px;
 
-       font-size: 13px;
 
-       color: #495057;
 
-     }
 
-     
 
-     .button-group {
 
-       display: flex;
 
-       gap: 10px;
 
-       margin-bottom: 20px;
 
-       flex-wrap: wrap;
 
-     }
 
-     
 
-     button {
 
-       background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
 
-       color: white;
 
-       border: none;
 
-       padding: 12px 24px;
 
-       border-radius: 8px;
 
-       font-size: 14px;
 
-       font-weight: 500;
 
-       cursor: pointer;
 
-       transition: transform 0.2s, box-shadow 0.2s;
 
-       flex: 1;
 
-       min-width: 200px;
 
-     }
 
-     
 
-     button:hover {
 
-       transform: translateY(-2px);
 
-       box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
 
-     }
 
-     
 
-     button:active {
 
-       transform: translateY(0);
 
-     }
 
-     
 
-     button:disabled {
 
-       opacity: 0.6;
 
-       cursor: not-allowed;
 
-     }
 
-     
 
-     button.secondary {
 
-       background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
 
-     }
 
-     
 
-     button.success {
 
-       background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
 
-     }
 
-     
 
-     .result {
 
-       background: #f8f9fa;
 
-       border-radius: 8px;
 
-       padding: 20px;
 
-       margin-top: 20px;
 
-       display: none;
 
-     }
 
-     
 
-     .result.show {
 
-       display: block;
 
-     }
 
-     
 
-     .result h3 {
 
-       color: #333;
 
-       margin-bottom: 15px;
 
-       font-size: 18px;
 
-     }
 
-     
 
-     .url-list {
 
-       list-style: none;
 
-     }
 
-     
 
-     .url-item {
 
-       background: white;
 
-       border: 1px solid #dee2e6;
 
-       border-radius: 6px;
 
-       padding: 15px;
 
-       margin-bottom: 10px;
 
-       transition: border-color 0.2s;
 
-     }
 
-     
 
-     .url-item:hover {
 
-       border-color: #667eea;
 
-     }
 
-     
 
-     .url-item-header {
 
-       display: flex;
 
-       justify-content: space-between;
 
-       align-items: center;
 
-       margin-bottom: 8px;
 
-     }
 
-     
 
-     .url-item-title {
 
-       font-weight: 600;
 
-       color: #333;
 
-       font-size: 14px;
 
-     }
 
-     
 
-     .url-item-badge {
 
-       background: #e7f3ff;
 
-       color: #0066cc;
 
-       padding: 4px 8px;
 
-       border-radius: 4px;
 
-       font-size: 12px;
 
-     }
 
-     
 
-     .url-item-info {
 
-       color: #666;
 
-       font-size: 13px;
 
-       margin-bottom: 8px;
 
-     }
 
-     
 
-     .url-item-link {
 
-       background: #f8f9fa;
 
-       padding: 10px;
 
-       border-radius: 4px;
 
-       font-family: 'Courier New', monospace;
 
-       font-size: 12px;
 
-       color: #495057;
 
-       word-break: break-all;
 
-       margin-bottom: 8px;
 
-     }
 
-     
 
-     .url-item-actions {
 
-       display: flex;
 
-       gap: 8px;
 
-     }
 
-     
 
-     .url-item-actions button {
 
-       flex: 1;
 
-       min-width: auto;
 
-       padding: 8px 16px;
 
-       font-size: 13px;
 
-     }
 
-     
 
-     .loading {
 
-       text-align: center;
 
-       padding: 40px;
 
-       color: #666;
 
-     }
 
-     
 
-     .spinner {
 
-       border: 3px solid #f3f3f3;
 
-       border-top: 3px solid #667eea;
 
-       border-radius: 50%;
 
-       width: 40px;
 
-       height: 40px;
 
-       animation: spin 1s linear infinite;
 
-       margin: 0 auto 20px;
 
-     }
 
-     
 
-     @keyframes spin {
 
-       0% { transform: rotate(0deg); }
 
-       100% { transform: rotate(360deg); }
 
-     }
 
-     
 
-     .error {
 
-       background: #fff5f5;
 
-       border-left: 4px solid #e53e3e;
 
-       padding: 15px;
 
-       border-radius: 4px;
 
-       color: #c53030;
 
-       margin-top: 20px;
 
-     }
 
-     
 
-     .success-message {
 
-       background: #f0fff4;
 
-       border-left: 4px solid #38a169;
 
-       padding: 15px;
 
-       border-radius: 4px;
 
-       color: #276749;
 
-       margin-top: 20px;
 
-     }
 
-   </style>
 
- </head>
 
- <body>
 
-   <div class="container">
 
-     <h1>🚀 会话激活测试地址获取工具</h1>
 
-     <p class="subtitle">快速获取企业微信群聊的会话激活页面测试地址</p>
 
-     
 
-     <div class="info-box">
 
-       <h3>📋 您的配置信息</h3>
 
-       <p><strong>公司ID (cid):</strong> <code>cDL6R1hgSi</code></p>
 
-       <p><strong>用户ID:</strong> <code>woAs2qCQAAGQckyg7AQBxhMEoSwnlTvg</code></p>
 
-     </div>
 
-     
 
-     <div class="button-group">
 
-       <button onclick="getAllGroupChats()">
 
-         📡 获取所有群聊地址
 
-       </button>
 
-       <button class="secondary" onclick="createTestGroupChat()">
 
-         ➕ 创建测试群聊
 
-       </button>
 
-       <button class="success" onclick="setupLocalStorage()">
 
-         💾 配置本地存储
 
-       </button>
 
-     </div>
 
-     
 
-     <div id="result" class="result">
 
-       <!-- 结果将显示在这里 -->
 
-     </div>
 
-   </div>
 
-   <script>
 
-     const CID = 'cDL6R1hgSi';
 
-     const USER_ID = 'woAs2qCQAAGQckyg7AQBxhMEoSwnlTvg';
 
-     
 
-     // 配置本地存储
 
-     function setupLocalStorage() {
 
-       try {
 
-         localStorage.setItem('company', CID);
 
-         localStorage.setItem(`${CID}/USERINFO`, JSON.stringify({
 
-           userid: USER_ID,
 
-           errcode: 0,
 
-           errmsg: 'ok',
 
-           cid: CID
 
-         }));
 
-         
 
-         showSuccess('✅ 本地存储配置成功!现在可以正常访问会话激活页面了。');
 
-       } catch (error) {
 
-         showError('配置失败: ' + error.message);
 
-       }
 
-     }
 
-     
 
-     // 获取所有群聊
 
-     async function getAllGroupChats() {
 
-       const resultDiv = document.getElementById('result');
 
-       resultDiv.innerHTML = '<div class="loading"><div class="spinner"></div><p>正在加载群聊列表...</p></div>';
 
-       resultDiv.classList.add('show');
 
-       
 
-       try {
 
-         // 动态导入Parse
 
-         const { FmodeParse } = await import('https://unpkg.com/fmode-ng@latest/parse/index.js');
 
-         const Parse = FmodeParse.with('nova');
 
-         
 
-         console.log('✅ Parse SDK加载成功');
 
-         
 
-         // 查询群聊
 
-         const query = new Parse.Query('GroupChat');
 
-         query.equalTo('company', { __type: 'Pointer', className: 'Company', objectId: CID });
 
-         query.include('project');
 
-         query.descending('createdAt');
 
-         query.limit(50);
 
-         
 
-         const chats = await query.find();
 
-         
 
-         console.log(`✅ 找到 ${chats.length} 个群聊`);
 
-         
 
-         if (chats.length === 0) {
 
-           resultDiv.innerHTML = `
 
-             <h3>😕 未找到群聊</h3>
 
-             <p>数据库中没有找到群聊记录。请点击"创建测试群聊"按钮创建一个。</p>
 
-           `;
 
-           return;
 
-         }
 
-         
 
-         // 生成URL列表
 
-         let html = `<h3>📱 找到 ${chats.length} 个群聊</h3><ul class="url-list">`;
 
-         
 
-         chats.forEach((chat, index) => {
 
-           const chatId = chat.id;
 
-           const chatName = chat.get('name') || '未命名群聊';
 
-           const project = chat.get('project');
 
-           const projectName = project ? project.get('title') : '无项目';
 
-           const memberList = chat.get('member_list') || [];
 
-           const memberCount = memberList.length;
 
-           const url = `http://localhost:4200/wxwork/${CID}/chat-activation/${chatId}`;
 
-           
 
-           html += `
 
-             <li class="url-item">
 
-               <div class="url-item-header">
 
-                 <span class="url-item-title">${index + 1}. ${chatName}</span>
 
-                 <span class="url-item-badge">${memberCount} 成员</span>
 
-               </div>
 
-               <div class="url-item-info">
 
-                 📁 项目: ${projectName} | 🆔 ID: ${chatId}
 
-               </div>
 
-               <div class="url-item-link">${url}</div>
 
-               <div class="url-item-actions">
 
-                 <button onclick="copyUrl('${url}')">📋 复制</button>
 
-                 <button onclick="openUrl('${url}')">🚀 打开</button>
 
-               </div>
 
-             </li>
 
-           `;
 
-         });
 
-         
 
-         html += '</ul>';
 
-         resultDiv.innerHTML = html;
 
-         
 
-       } catch (error) {
 
-         console.error('❌ 错误:', error);
 
-         showError('加载失败: ' + error.message + '<br><br>请确保:<br>1. 项目已启动 (npm start)<br>2. Parse Server已连接<br>3. 网络正常');
 
-       }
 
-     }
 
-     
 
-     // 创建测试群聊
 
-     async function createTestGroupChat() {
 
-       const resultDiv = document.getElementById('result');
 
-       resultDiv.innerHTML = '<div class="loading"><div class="spinner"></div><p>正在创建测试群聊...</p></div>';
 
-       resultDiv.classList.add('show');
 
-       
 
-       try {
 
-         const { FmodeParse } = await import('https://unpkg.com/fmode-ng@latest/parse/index.js');
 
-         const Parse = FmodeParse.with('nova');
 
-         
 
-         const GroupChat = Parse.Object.extend('GroupChat');
 
-         const testChat = new GroupChat();
 
-         
 
-         const timestamp = new Date().toLocaleString('zh-CN');
 
-         
 
-         testChat.set('name', `测试群聊 - ${timestamp}`);
 
-         testChat.set('company', { __type: 'Pointer', className: 'Company', objectId: CID });
 
-         testChat.set('chat_id', 'test_chat_' + Date.now());
 
-         testChat.set('member_list', [
 
-           {
 
-             type: 1, // 内部成员
 
-             userid: 'tech_001',
 
-             name: '技术员-张三',
 
-             avatar: 'https://via.placeholder.com/100?text=Tech'
 
-           },
 
-           {
 
-             type: 2, // 外部联系人(客户)
 
-             userid: 'customer_001',
 
-             name: '客户-李四',
 
-             avatar: 'https://via.placeholder.com/100?text=Customer'
 
-           },
 
-           {
 
-             type: 2,
 
-             userid: 'customer_002',
 
-             name: '客户-王五',
 
-             avatar: 'https://via.placeholder.com/100?text=Customer2'
 
-           }
 
-         ]);
 
-         testChat.set('messages', [
 
-           {
 
-             msgid: 'msg_001',
 
-             from: 'customer_001',
 
-             msgtime: Math.floor(Date.now() / 1000) - 3600, // 1小时前
 
-             msgtype: 'text',
 
-             text: { content: '你好,我想咨询一下项目进度' }
 
-           },
 
-           {
 
-             msgid: 'msg_002',
 
-             from: 'tech_001',
 
-             msgtime: Math.floor(Date.now() / 1000) - 3500,
 
-             msgtype: 'text',
 
-             text: { content: '您好,项目正在进行中,预计本周完成' }
 
-           },
 
-           {
 
-             msgid: 'msg_003',
 
-             from: 'customer_001',
 
-             msgtime: Math.floor(Date.now() / 1000) - 700, // 12分钟前(超时未回复)
 
-             msgtype: 'text',
 
-             text: { content: '可以帮我修改一下需求吗?需要增加一个功能' }
 
-           },
 
-           {
 
-             msgid: 'msg_004',
 
-             from: 'customer_002',
 
-             msgtime: Math.floor(Date.now() / 1000) - 300, // 5分钟前
 
-             msgtype: 'text',
 
-             text: { content: '设计稿什么时候能出来?' }
 
-           }
 
-         ]);
 
-         testChat.set('data', {
 
-           description: '这是一个测试群聊,用于演示会话激活功能',
 
-           createdBy: 'test_tool'
 
-         });
 
-         
 
-         const saved = await testChat.save();
 
-         const url = `http://localhost:4200/wxwork/${CID}/chat-activation/${saved.id}`;
 
-         
 
-         console.log('✅ 测试群聊创建成功:', saved.id);
 
-         
 
-         resultDiv.innerHTML = `
 
-           <div class="success-message">
 
-             <h3>✅ 测试群聊创建成功!</h3>
 
-             <p><strong>群聊名称:</strong> ${saved.get('name')}</p>
 
-             <p><strong>群聊ID:</strong> ${saved.id}</p>
 
-             <p><strong>成员数:</strong> 3人 (1个技术员 + 2个客户)</p>
 
-             <p><strong>消息数:</strong> 4条 (包含1条超时未回复)</p>
 
-           </div>
 
-           <ul class="url-list">
 
-             <li class="url-item">
 
-               <div class="url-item-header">
 
-                 <span class="url-item-title">测试群聊地址</span>
 
-                 <span class="url-item-badge">新创建</span>
 
-               </div>
 
-               <div class="url-item-link">${url}</div>
 
-               <div class="url-item-actions">
 
-                 <button onclick="copyUrl('${url}')">📋 复制</button>
 
-                 <button onclick="openUrl('${url}')">🚀 打开</button>
 
-               </div>
 
-             </li>
 
-           </ul>
 
-         `;
 
-         
 
-       } catch (error) {
 
-         console.error('❌ 错误:', error);
 
-         showError('创建失败: ' + error.message);
 
-       }
 
-     }
 
-     
 
-     // 复制URL
 
-     function copyUrl(url) {
 
-       navigator.clipboard.writeText(url).then(() => {
 
-         alert('✅ 地址已复制到剪贴板!\n\n' + url);
 
-       }).catch(err => {
 
-         alert('❌ 复制失败,请手动复制:\n\n' + url);
 
-       });
 
-     }
 
-     
 
-     // 打开URL
 
-     function openUrl(url) {
 
-       window.open(url, '_blank');
 
-     }
 
-     
 
-     // 显示成功消息
 
-     function showSuccess(message) {
 
-       const resultDiv = document.getElementById('result');
 
-       resultDiv.innerHTML = `<div class="success-message">${message}</div>`;
 
-       resultDiv.classList.add('show');
 
-     }
 
-     
 
-     // 显示错误消息
 
-     function showError(message) {
 
-       const resultDiv = document.getElementById('result');
 
-       resultDiv.innerHTML = `<div class="error">${message}</div>`;
 
-       resultDiv.classList.add('show');
 
-     }
 
-     
 
-     // 页面加载时自动配置localStorage
 
-     window.addEventListener('DOMContentLoaded', () => {
 
-       setupLocalStorage();
 
-     });
 
-   </script>
 
- </body>
 
- </html>
 
 
  |