{"id":917,"date":"2025-11-13T14:55:04","date_gmt":"2025-11-13T06:55:04","guid":{"rendered":"https:\/\/explore2022.com\/?page_id=917"},"modified":"2025-11-13T16:12:58","modified_gmt":"2025-11-13T08:12:58","slug":"csgo%e4%bb%b7%e6%a0%bc%e6%9f%a5%e8%af%a2%e6%9c%8d%e5%8a%a1","status":"publish","type":"page","link":"https:\/\/www.explore2022.com\/?page_id=917","title":{"rendered":"CSGO\u4ef7\u683c\u67e5\u8be2\u670d\u52a1"},"content":{"rendered":"\n<script src=\"https:\/\/cdn.jsdelivr.net\/npm\/chart.js\"><\/script>\n\n<div id=\"csgo-widget\" style=\"max-width:900px;margin:auto;font-family:Arial;\">\n  <h3>CS:GO \u88c5\u5907\u4ef7\u683c\u67e5\u8be2<\/h3>\n  <input id=\"itemName\" type=\"text\" placeholder=\"\u8f93\u5165\u82f1\u6587\u5168\u540d\uff0c\u4f8b\u5982\uff1aAK-47 | Redline (Field-Tested)\" style=\"width:400px;padding:6px;\">\n  <select id=\"timeRange\">\n    <option value=\"week\">\u4e00\u5468<\/option>\n    <option value=\"month\" selected>\u4e00\u6708<\/option>\n    <option value=\"year\">\u4e00\u5e74<\/option>\n  <\/select>\n  <select id=\"currency\">\n    <option value=\"USD\" selected>USD<\/option>\n    <option value=\"CNH\">CNH<\/option>\n  <\/select>\n  <button id=\"btnQuery\">\u67e5\u8be2<\/button>\n  <div id=\"info\" style=\"margin-top:10px;\"><\/div>\n  <canvas id=\"chart\" height=\"200\"><\/canvas>\n<\/div>\n\n<script>\nconst API_BASE = 'https:\/\/cs.202620260.xyz\/api';\nlet currentName = '';\nlet currentCurrency = 'USD';\nlet currentChart = null;\n\nasync function fetchPrice(name, currency){\n  const res = await fetch(`${API_BASE}\/price?name=${encodeURIComponent(name)}&currency=${currency}`);\n  const data = await res.json();\n  if(data.error) throw new Error(data.error);\n  return data.data;\n}\n\nasync function fetchHistory(name, range, currency){\n  const res = await fetch(`${API_BASE}\/history?name=${encodeURIComponent(name)}&range=${range}&currency=${currency}`);\n  const data = await res.json();\n  if(!data.history) throw new Error('\u65e0\u5386\u53f2\u6570\u636e');\n  return data.history;\n}\n\nasync function updateChart(){\n  if(!currentName) return;\n  const range = document.getElementById('timeRange').value;\n  const currency = document.getElementById('currency').value;\n  currentCurrency = currency;\n  document.getElementById('info').innerText = '\u67e5\u8be2\u4e2d...';\n  try{\n    const priceData = await fetchPrice(currentName, currency)\n    document.getElementById('info').innerHTML = `<b>${currentName}<\/b> \u5f53\u524d\u4ef7\uff1a${priceData.price} ${currency}`;\n\n    const hist = await fetchHistory(currentName, range, currency)\n    const labels = hist.map(pt=>new Date(pt.ts*1000).toLocaleString())\n    const prices = hist.map(pt=>pt.price)\n\n    const ctx = document.getElementById('chart').getContext('2d')\n    if(currentChart) currentChart.destroy()\n    currentChart = new Chart(ctx,{\n      type:'line',\n      data:{labels,datasets:[{label:`${currentName} (${currency})`,data:prices,borderWidth:1.5,pointRadius:0}]},\n      options:{scales:{x:{display:true},y:{display:true}}}\n    })\n  }catch(e){\n    console.error(e)\n    document.getElementById('info').innerText='\u83b7\u53d6\u6570\u636e\u5931\u8d25: '+e\n  }\n}\n\ndocument.getElementById('btnQuery').addEventListener('click', ()=>{\n  const name = document.getElementById('itemName').value.trim();\n  if(!name) return alert('\u8bf7\u8f93\u5165\u88c5\u5907\u82f1\u6587\u5168\u540d');\n  currentName = name;\n  updateChart();\n});\n\ndocument.getElementById('timeRange').addEventListener('change', updateChart);\ndocument.getElementById('currency').addEventListener('change', updateChart);\n<\/script>\n\n\n\n\n<p>\u4e3e\u4f8b\uff1a<\/p>\n\n\n\n<p>AK-47 | Redline (Field-Tested)<\/p>\n\n\n\n<p>steam \u793e\u533a\u5e02\u573a\uff1a<a href=\"https:\/\/steamcommunity.com\/market\/\" target=\"_blank\"  rel=\"nofollow\" >\u70b9\u51fb\u8df3\u8f6c\u67e5\u8be2\u540d\u79f0<\/a>  <\/p>\n\n\n\n<p>\u6ce8\u91ca\uff1a\u53f3\u4e0a\u89d2\u8bed\u8a00\u5207\u6362\u4e3a\u82f1\u6587\u67e5\u8be2\u82f1\u6587\u540d\u79f0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CS:GO \u88c5\u5907\u4ef7\u683c\u67e5\u8be2 \u4e00\u5468\u4e00\u6708\u4e00\u5e74 USDCNH \u67e5\u8be2 \u4e3e\u4f8b\uff1a AK-47 | Redline (Field-Tested)  &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"_links":{"self":[{"href":"https:\/\/www.explore2022.com\/index.php?rest_route=\/wp\/v2\/pages\/917"}],"collection":[{"href":"https:\/\/www.explore2022.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.explore2022.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.explore2022.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.explore2022.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=917"}],"version-history":[{"count":6,"href":"https:\/\/www.explore2022.com\/index.php?rest_route=\/wp\/v2\/pages\/917\/revisions"}],"predecessor-version":[{"id":935,"href":"https:\/\/www.explore2022.com\/index.php?rest_route=\/wp\/v2\/pages\/917\/revisions\/935"}],"wp:attachment":[{"href":"https:\/\/www.explore2022.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=917"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}