endpoints.path: /
endpoints.endpoint_type: HTTP
endpoints.scan_time: 2025-10-12T12:45:54.357548
endpoints.uri: https://liveyun.okq.cc/
endpoints.protocol: HTTP/1.1
endpoints.status_reason: OK
endpoints.key: Server
endpoints.headers: nginx
endpoints.key: Last-Modified
endpoints.headers: Sun, 12 Oct 2025 12:35:03 GMT
endpoints.key: Transfer-Encoding
endpoints.headers: chunked
endpoints.key: ETag
endpoints.headers: W/"68eba077-3800"
endpoints.key: Content-Type
endpoints.headers: text/html
endpoints.key: Connection
endpoints.headers: keep-alive
endpoints.key: Vary
endpoints.headers: Accept-Encoding
endpoints.key: Date
endpoints.headers: <REDACTED>
endpoints.key: Content-Encoding
endpoints.headers: gzip
endpoints.html_tags: <title>微信个人中心</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
endpoints.body: <!DOCTYPE html>
  <html lang="zh-CN">
  <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>微信个人中心</title>
      <script src="./tailwindcss3.4.17.js"></script>
        <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
      <!-- <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">-->
      <script>
          tailwind.config = {
              theme: {
                  extend: {
                      colors: {
                          primary: '#1677ff',
                          secondary: '#0958d9',
                          light: '#f0f2f5',
                      },
                      fontFamily: {
                          sans: ['Inter', 'system-ui', 'sans-serif'],
                      },
                  }
              }
          }
      </script>
      <style type="text/tailwindcss">
          @layer utilities {
              .content-auto {
                  content-visibility: auto;
              }
              .card-shadow {
                  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
              }
              .gradient-bg {
                  background: linear-gradient(135deg, #1677ff 0%, #0958d9 100%);
              }
          }
      </style>
  </head>
  <body class="bg-light min-h-screen font-sans">
      <!-- 加载中状态 -->
      <div id="loading" class="fixed inset-0 z-50 flex items-center justify-center bg-white">
          <div class="text-center">
              <div class="w-16 h-16 border-4 border-primary border-t-transparent rounded-full animate-spin mx-auto"></div>
              <p class="mt-4 text-gray-600">正在加载...</p>
          </div>
      </div>
  
      <!-- 未授权提示 -->
      <div id="unauthorized" class="hidden min-h-screen flex flex-col items-center justify-center p-6">
          <div class="w-24 h-24 rounded-full gradient-bg flex items-center justify-center mb-6">
              <i class="fa fa-weixin text-white text-4xl"></i>
          </div>
          <h2 class="text-2xl font-bold text-gray-800 mb-2">需要微信授权</h2>
          <p class="text-gray-500 mb-8 text-center">为了提供更好的服务，请先授权登录</p>
          <button id="authorizeBtn" class="bg-primary hover:bg-secondary text-white px-8 py-3 rounded-full transition-all duration-300 shadow-lg hover:shadow-xl transform hover:-translate-y-1">
              <i class="fa fa-sign-in mr-2"></i>微信授权登录
          </button>
      </div>
  
      <!-- 个人信息页面 -->
      <div id="userProfile" class="hidden">
          <!-- 头部信息 -->
          <header class="gradient-bg text-white p-6 pb-16 relative overflow-hidden">
              <div class="absolute top-0 right-0 w-40 h-40 bg-white/10 rounded-full -mr-20 -mt-20"></div>
              <div class="absolute bottom-0 left-0 w-32 h-32 bg-white/10 rounded-full -ml-16 -mb-16"></div>
              
              <div class="relative z-10">
                  <div class="flex items-center">
                      <img id="avatar" src="" alt="用户头像" class="w-20 h-20 rounded-full border-4 border-white/30">
                      <div class="ml-4">
                          <h1 id="nickname" class="text-xl font-bold"></h1>
                          <p class="text-white/80 text-sm mt-1"><i class="fa fa-map-marker mr-1"></i><span id="city"></span></p>
                      </div>
                  </div>
              </div>
          </header>
  
          <!-- 个人信息卡片 -->
          <div class="container mx-auto px-6 -mt-10 relative z-20">
              <div class="bg-white rounded-xl p-6 card-shadow mb-6">
                  <h3 class="text-gray-500 text-sm mb-4">基本信息</h3>
                  <div class="grid grid-cols-2 gap-4">
                      <div class="flex items-center">
                          <div class="w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center text-primary">
                              <i class="fa fa-id-card"></i>
                          </div>
                          <div class="ml-3">
                              <p class="text-gray-500 text-sm">性别</p>
                              <p id="gender" class="font-medium"></p>
                          </div>
                      </div>
                      <div class="flex items-center">
                          <div class="w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center text-primary">
                              <i class="fa fa-flag"></i>
                          </div>
                          <div class="ml-3">
                              <p class="text-gray-500 text-sm">国家/地区</p>
                              <p id="country" class="font-medium"></p>
                          </div>
                      </div>
                      <div class="flex items-center">
                          <div class="w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center text-primary">
                              <i class="fa fa-map"></i>
                          </div>
                          <div class="ml-3">
                              <p class="text-gray-500 text-sm">省份</p>
                              <p id="province" class="font-medium"></p>
                          </div>
                      </div>
                      <div class="flex items-center">
                          <div class="w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center text-primary">
                              <i class="fa fa-weixin"></i>
                          </div>
                          <div class="ml-3">
                              <p class="text-gray-500 text-sm">关注状态</p>
                              <p id="subscribe" class="font-medium"></p>
                          </div>
                      </div>
                  </div>
              </div>
  
              <!-- 功能区域 -->
              <div class="bg-white rounded-xl p-6 card-shadow mb-6">
                  <h3 class="text-gray-500 text-sm mb-4">功能菜单</h3>
                  <div class="grid grid-cols-3 gap-4">
                      <div class="flex flex-col items-center justify-center p-4 rounded-lg hover:bg-light transition-colors duration-200 cursor-pointer">
                          <div onclick='chooseAddress()' class="w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center text-primary mb-2">
                              <i class="fa fa-cog text-xl"></i>
                          </div>
                          <span  class="text-sm">设置</span>
                      </div>
                      <div class="flex flex-col items-center justify-center p-4 rounded-lg hover:bg-light transition-colors duration-200 cursor-pointer">
                          <div class="w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center text-primary mb-2">
                              <i class="fa fa-bell text-xl"></i>
                          </div>
                          <span class="text-sm">通知</span>
                      </div>
                      <div class="flex flex-col items-center justify-center p-4 rounded-lg hover:bg-light transition-colors duration-200 cursor-pointer">
                          <div class="w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center text-primary mb-2">
                              <i class="fa fa-question-circle text-xl"></i>
                          </div>
                          <span class="text-sm">帮助</span>
                      </div>
                  </div>
              </div>
  
              <!-- 退出按钮 -->
              <button id="logoutBtn" class="w-full py-3 border border-gray-300 rounded-lg text-gray-600 hover:bg-gray-50 transition-colors duration-200">
                  <i class="fa fa-sign-out mr-2"></i>退出登录
              </button>
          </div>
  
          <!-- 底部 -->
          <footer class="text-center text-gray-400 text-sm py-8 mt-8">
              <p>© 2025 微信公众号平台</p>
          </footer>
      </div>
  
    <script>
      // 当前页面的完整URL（需与公众号配置的安全域名一致）
  
  function isWechat() {
    return /MicroMessenger/i.test(navigator.userAgent);
  }
  console.log('是否在微信环境：', isWechat()); // 必须为 true
      // 调用微信地址选择接口
      function chooseAddress() {
        wx.openAddress({
          success: res => {
            // 地址信息返回格式：
            /* {
              userName: '张三',       // 收货人姓名
              telNumber: '13800138000', // 电话
              provinceName: '广东省',  // 省份
              cityName: '深圳市',     // 城市
              countyName: '南山区',   // 区/县
              detailInfo: '科技园路1号', // 详细地址
              nationalCode: '518000',  // 邮政编码
              errMsg: 'chooseAddress:ok'
            } */
            const addressEl = document.getElementById('addressResult');
            addressEl.innerHTML = `
              <p>姓名：${res.userName}</p>
              <p>电话：${res.telNumber}</p>
              <p>地址：${res.provinceName}${res.cityName}${res.countyName}${res.detailInfo}</p>
              <p>邮编：${res.nationalCode}</p>
            `;
          },
          fail: err => {
            console.error('选择地址失败：', err);
            alert('请允许获取地址权限');
          }
        });
      }
    </script>
      <script>
          // 页面加载完成后执行
          document.addEventListener('DOMContentLoaded', function() {
              // 隐藏加载状态，显示适当内容
              setTimeout(() => {
                  document.getElementById('loading').classList.add('hidden');
                  
                  // 检查URL中是否有code参数（授权回调）
                  const urlParams = new URLSearchParams(window.location.search);
                  const code = urlParams.get('code');
                  
                  if (code) {
                      // 有code，获取用户信息
                      fetch(`/api/userinfo?code=${code}`)
                          .then(response => response.json())
                          .then(data => {
                              if (data.success) {
                                  // 保存用户信息到本地存储
                                  console.log(data.data);
                                  localStorage.setItem('userInfo', JSON.stringify(data.data));
                                  console.log(data.data);
                                  // 显示用户信息页面
                                  showUserProfile(data.data);
                                  // 移除URL中的code参数
                                  history.replaceState({}, document.title, window.location.pathname);
                              } else {
                                  // 获取用户信息失败，显示授权按钮
                                  document.getElementById('unauthorized').classList.remove('hidden');
                              }
                          })
                          .catch(error => {
                              console.error('获取用户信息失败:', error);
                              document.getElementById('unauthorized').classList.remove('hidden');
                          });
                  } else {
                      // 没有code，检查本地存储是否有用户信息
                      const storedUser = localStorage.getItem('userInfo');
                      if (storedUser) {
                          // 显示用户信息页面
                          showUserProfile(JSON.parse(storedUser));
                      } else {
                          // 显示授权按钮
                          document.getElementById('unauthorized').classList.remove('hidden');
                      }
                  }
              }, 1000);
  
              // 授权按钮点击事件
              document.getElementById('authorizeBtn').addEventListener('click', function() {
                  // 跳转到微信授权页面
                  window.location.href = 'https://liveyun.okq.cc/api/authorize';
              });
  
              // 退出登录按钮点击事件
              document.getElementById('logoutBtn').addEventListener('click', function() {
                  // 清除本地存储的用户信息
                  localStorage.removeItem('userInfo');
                  // 显示授权页面
                  document.getElementById('userProfile').classList.add('hidden');
                  document.getElementById('unauthorized').classList.remove('hidden');
              });
          });
  
          // 显示用户信息
          function showUserProfile(userInfo) {
              
              document.getElementById('avatar').src = userInfo.headimgurl || '';
              document.getElementById('nickname').textContent = userInfo.nickname || '未知用户';
              document.getElementById('gender').textContent = userInfo.sex === 1 ? '男' : userInfo.sex === 2 ? '女' : '未知';
              document.getElementById('country').textContent = userInfo.country || '未知';
              document.getElementById('province').textContent = userInfo.province || '未知';
              document.getElementById('city').textContent = userInfo.city || '未知城市';
              document.getElementById('subscribe').textContent = userInfo.subscribe === 1 ? '已关注' : '未关注';
              
              // 显示用户信息页面
              document.getElementById('userProfile').classList.remove('hidden');
              
                  const currentUrl = window.location.href.split('#')[0]; // 去除hash部分
  
      // 从后端获取签名
      fetch(`/cs/wx/signature?url=${encodeURIComponent(currentUrl)}`)
        .then(res => res.json())
        .then(signData => {
          // 配置微信JS-SDK
          wx.config({
            debug: true, // 调试模式：true时会打印日志
            appId: signData.appId,
            timestamp: signData.timestamp,
            nonceStr: signData.nonceStr,
            signature: signData.signature,
            jsApiList: ['chooseAddress'] // 需要使用的接口
          });
  
          // 验证配置是否成功
          wx.ready(() => {
            console.log('微信JS-SDK配置成功');
          });
  
          wx.error(err => {
            console.error('微信JS-SDK配置失败：', err);
          });
        })
        .catch(err => {
          console.error('获取签名失败：', err);
        });
          }
      </script>
  </body>
  </html>
  
endpoints.html_title: 微信个人中心
endpoints.supported_versions: HTTP/1.1
endpoints.banner: HTTP/1.1 200 OK
  Server: nginx
  Date:  <REDACTED>
  Content-Type: text/html
  Last-Modified: Sun, 12 Oct 2025 12:35:03 GMT
  Transfer-Encoding: chunked
  Connection: keep-alive
  Vary: Accept-Encoding
  ETag: W/"68eba077-3800"
  Content-Encoding: gzip
  
endpoints.ip: 119.29.231.133
[binary data, 4 values, 119 bytes]