
const fetch = require('node-fetch'); // Node.js 18以下版本需要安装 node-fetch
const tools = require('../../../tools');
const config  = require('../../../etc/config.json');
const redis_help = require('../../use_redis');
const helper = require('../../helper');
const CMD = {}

CMD.collect = async function() {
  try{
      let timestamp = helper.getCurrentUnixTimestamp()
      let response = await fetch("https://galileotelemetry.tencent.com/collect", {
        "headers": {
          "accept": "*/*",
          "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
          "content-type": "text/plain;charset=UTF-8",
          "priority": "u=1, i",
          "sec-ch-ua": "\"Microsoft Edge\";v=\"131\", \"Chromium\";v=\"131\", \"Not_A Brand\";v=\"24\"",
          "sec-ch-ua-mobile": "?0",
          "sec-ch-ua-platform": "\"Windows\"",
          "sec-fetch-dest": "empty",
          "sec-fetch-mode": "cors",
          "sec-fetch-site": "cross-site",
          "Referer": "https://open.yuewen.com/",
          "Referrer-Policy": "strict-origin-when-cross-origin"
        },
        "body": `{\"topic\":\"SDK-b301aa81eeb68c449147\",\"data\":[{\"message\":\"{\\\"msg\\\":\\\"\\\",\\\"url\\\":\\\"//open.yuewen.com/api/Account/getActiveInfo\\\",\\\"status\\\":200,\\\"duration\\\":151,\\\"method\\\":\\\"GET\\\",\\\"param\\\":\\\"\\\",\\\"data\\\":\\\"\\\",\\\"reqHeaders\\\":\\\"\\\",\\\"resHeaders\\\":\\\"\\\",\\\"level\\\":\\\"info\\\",\\\"ret\\\":\\\"0\\\",\\\"isErr\\\":false,\\\"trace\\\":\\\"\\\",\\\"span\\\":\\\"\\\",\\\"nextHopProtocol\\\":\\\"\\\",\\\"timestamp\\\":${timestamp}}\",\"fields\":\"{\\\"id\\\":\\\"SDK-b301aa81eeb68c449147\\\",\\\"uid\\\":\\\"\\\",\\\"aid\\\":\\\"0bf5aa4c-d8ed-4bba-b9ed-50d6462ec914\\\",\\\"env\\\":\\\"production\\\",\\\"platform\\\":\\\"windows\\\",\\\"netType\\\":\\\"4G\\\",\\\"vp\\\":\\\"525 * 602\\\",\\\"sr\\\":\\\"1280 * 720\\\",\\\"from\\\":\\\"https://open.yuewen.com/new\\\",\\\"referer\\\":\\\"https://open.yuewen.com/\\\",\\\"type\\\":\\\"api\\\"}\",\"timestamp\":${timestamp}}]}`,
        "method": "POST"
      });
      const data = await response.json();
      console.log('响应状态:', response.status);
      console.log('响应数据:', data);
  }catch(e){

  }
}

module.exports = CMD;