geezer-hmdyp

Calculate how much did you paid for PerfectWorldGame.

  1. // ==UserScript==
  2. // @name geezer-hmdyp
  3. // @namespace aidacafe
  4. // @version 1.1.1
  5. // @author 1shin
  6. // @description:zh-CN 算算你给完美爆了多少金币。
  7. // @description:en-US Calculate how much did you paid for PerfectWorldGame.
  8. // @license MIT License
  9. // @icon https://api.iconify.design/cryptocurrency-color:btc.svg
  10. // @match https://i.laohu.com/billing/chargeDetailRecord*
  11. // @match https://id.wanmei.com/billing/chargeDetailRecord*
  12. // @require https://registry.npmmirror.com/preact/10.19.3/files/dist/preact.min.js
  13. // @require https://registry.npmmirror.com/write-excel-file/1.4.30/files/bundle/write-excel-file.min.js
  14. // @grant GM_addStyle
  15. // @contributionURL https://github.com/AidaCafe/geezer-hmdyp
  16. // @description Calculate how much did you paid for PerfectWorldGame.
  17. // ==/UserScript==
  18.  
  19. (t=>{if(typeof GM_addStyle=="function"){GM_addStyle(t);return}const e=document.createElement("style");e.textContent=t,document.head.append(e)})(' .calcBtnGroup{display:inline-flex;max-width:max-content;max-height:max-content;border:2px solid #ff6960;border-radius:8px}.calcBtnGroup button{border:none;padding:8px;color:#ff6960;background-color:transparent}.calcBtnGroup button svg{vertical-align:middle}.calcBtnGroup button:hover{background-color:#ff6960;color:#f0f8ff}.calcBtnGroup button:last-child{border-right:none}.calcBtnGroup button:not(:last-child){border-right:2px solid #ff6960}.reportTriggerBtn{display:relative;border:2px solid #ff6960;color:#ff6960;background-color:#fff;border-radius:8px;padding:8px}.reportTriggerBtn svg{vertical-align:middle}.reportPanel{display:flex;position:absolute;border-radius:12px;background-color:#fefefe;box-shadow:2px 2px 5px #bfbfbf;padding:42px 32px;right:3px;top:170px;flex-direction:row;max-height:max-content}.reportPanel_hide{display:none}.reportPanelData{flex-direction:row}.reportPanelStats{margin-left:20px;min-width:180px}.statsPanel{position:absolute;border-radius:8px;background-color:#fefefe;box-shadow:2px 2px 5px #bfbfbf;padding:12px 24px;bottom:16px;right:16px}.statsPanel li{line-height:1.6}.floatingButtons{position:absolute;max-width:max-content;top:16px;right:16px}.floatingButtons button{margin-left:8px;padding:8px;border:none;border-radius:8px;background-color:#fefefe;box-shadow:2px 2px 5px #bfbfbf}.reportTable{overflow:scroll;max-height:320px;max-width:455px;background-color:transparent}.reportTable th,.reportTable td{padding:2px 18px;border-top-width:0;border-left-width:0;white-space:nowrap}.reportTable td{border-bottom:1px solid #424242}.reportTable th:nth-last-child(1),.reportTable th:nth-last-child(2),.reportTable td:nth-last-child(1),.reportTable td:nth-last-child(2){text-align:center;padding:4px}.reportTable thead{position:sticky;top:0;background-color:#fefefea1;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);box-shadow:0 .5px 8px #bfbfbf}.dateTimeRange{display:flex;max-width:max-content;border:2px solid gray;border-radius:8px;padding:12px}.dateTimeRange input[type=datetime-local]{border:none;background-color:transparent}.dateTimeRange input[type=datetime-local]:first-child:after{content:"~";padding-left:12px;padding-right:12px}.hmdyp{display:inline-flex;flex-direction:row}.hmdyp>*{margin-left:8px} ');
  20.  
  21. (function (preact, writeXlsxFile) {
  22. 'use strict';
  23.  
  24. var f$1 = 0;
  25. function u$1(e2, t2, n, o2, i2, u2) {
  26. var a2, c2, p = {};
  27. for (c2 in t2)
  28. "ref" == c2 ? a2 = t2[c2] : p[c2] = t2[c2];
  29. var l2 = { type: e2, props: p, key: n, ref: a2, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --f$1, __i: -1, __u: 0, __source: i2, __self: u2 };
  30. if ("function" == typeof e2 && (a2 = e2.defaultProps))
  31. for (c2 in a2)
  32. void 0 === p[c2] && (p[c2] = a2[c2]);
  33. return preact.options.vnode && preact.options.vnode(l2), l2;
  34. }
  35. function SvgSpinners180RingWithBg(props) {
  36. return /* @__PURE__ */ u$1(
  37. "svg",
  38. {
  39. xmlns: "http://www.w3.org/2000/svg",
  40. width: "1em",
  41. height: "1em",
  42. viewBox: "0 0 24 24",
  43. ...props,
  44. children: [
  45. props.title && /* @__PURE__ */ u$1("title", { children: props.title }),
  46. /* @__PURE__ */ u$1(
  47. "path",
  48. {
  49. fill: "currentColor",
  50. d: "M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z",
  51. opacity: ".25"
  52. }
  53. ),
  54. /* @__PURE__ */ u$1(
  55. "path",
  56. {
  57. fill: "currentColor",
  58. d: "M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z",
  59. children: /* @__PURE__ */ u$1(
  60. "animateTransform",
  61. {
  62. attributeName: "transform",
  63. dur: "0.75s",
  64. repeatCount: "indefinite",
  65. type: "rotate",
  66. values: "0 12 12;360 12 12"
  67. }
  68. )
  69. }
  70. )
  71. ]
  72. }
  73. );
  74. }
  75. function CryptocurrencyColorBtc(props) {
  76. return /* @__PURE__ */ u$1(
  77. "svg",
  78. {
  79. xmlns: "http://www.w3.org/2000/svg",
  80. width: "1em",
  81. height: "1em",
  82. viewBox: "0 0 32 32",
  83. ...props,
  84. children: [
  85. props.title && /* @__PURE__ */ u$1("title", { children: props.title }),
  86. /* @__PURE__ */ u$1("g", { fill: "none", fillRule: "evenodd", children: [
  87. /* @__PURE__ */ u$1("circle", { cx: "16", cy: "16", r: "16", fill: "#F7931A" }),
  88. /* @__PURE__ */ u$1(
  89. "path",
  90. {
  91. fill: "#FFF",
  92. fillRule: "nonzero",
  93. d: "M23.189 14.02c.314-2.096-1.283-3.223-3.465-3.975l.708-2.84l-1.728-.43l-.69 2.765c-.454-.114-.92-.22-1.385-.326l.695-2.783L15.596 6l-.708 2.839c-.376-.086-.746-.17-1.104-.26l.002-.009l-2.384-.595l-.46 1.846s1.283.294 1.256.312c.7.175.826.638.805 1.006l-.806 3.235c.048.012.11.03.18.057l-.183-.045l-1.13 4.532c-.086.212-.303.531-.793.41c.018.025-1.256-.313-1.256-.313l-.858 1.978l2.25.561c.418.105.828.215 1.231.318l-.715 2.872l1.727.43l.708-2.84c.472.127.93.245 1.378.357l-.706 2.828l1.728.43l.715-2.866c2.948.558 5.164.333 6.097-2.333c.752-2.146-.037-3.385-1.588-4.192c1.13-.26 1.98-1.003 2.207-2.538m-3.95 5.538c-.533 2.147-4.148.986-5.32.695l.95-3.805c1.172.293 4.929.872 4.37 3.11m.535-5.569c-.487 1.953-3.495.96-4.47.717l.86-3.45c.975.243 4.118.696 3.61 2.733"
  94. }
  95. )
  96. ] })
  97. ]
  98. }
  99. );
  100. }
  101. function RiLineChartLine(props) {
  102. return /* @__PURE__ */ u$1(
  103. "svg",
  104. {
  105. xmlns: "http://www.w3.org/2000/svg",
  106. width: "1em",
  107. height: "1em",
  108. viewBox: "0 0 24 24",
  109. ...props,
  110. children: [
  111. props.title && /* @__PURE__ */ u$1("title", { children: props.title }),
  112. /* @__PURE__ */ u$1(
  113. "path",
  114. {
  115. fill: "currentColor",
  116. d: "M5 3v16h16v2H3V3zm15.293 3.293l1.414 1.414L16 13.414l-3-2.999l-4.293 4.292l-1.414-1.414L13 7.586l3 2.999z"
  117. }
  118. )
  119. ]
  120. }
  121. );
  122. }
  123. function RiSettingsLine(props) {
  124. return /* @__PURE__ */ u$1(
  125. "svg",
  126. {
  127. xmlns: "http://www.w3.org/2000/svg",
  128. width: "1em",
  129. height: "1em",
  130. viewBox: "0 0 24 24",
  131. ...props,
  132. children: [
  133. props.title && /* @__PURE__ */ u$1("title", { children: props.title }),
  134. /* @__PURE__ */ u$1(
  135. "path",
  136. {
  137. fill: "currentColor",
  138. d: "m12 1l9.5 5.5v11L12 23l-9.5-5.5v-11zm0 2.311L4.5 7.653v8.694l7.5 4.342l7.5-4.342V7.653zM12 16a4 4 0 1 1 0-8a4 4 0 0 1 0 8m0-2a2 2 0 1 0 0-4a2 2 0 0 0 0 4"
  139. }
  140. )
  141. ]
  142. }
  143. );
  144. }
  145. function RiWechatPayFill(props) {
  146. return /* @__PURE__ */ u$1(
  147. "svg",
  148. {
  149. xmlns: "http://www.w3.org/2000/svg",
  150. width: "1em",
  151. height: "1em",
  152. viewBox: "0 0 24 24",
  153. ...props,
  154. children: [
  155. props.title && /* @__PURE__ */ u$1("title", { children: props.title }),
  156. /* @__PURE__ */ u$1(
  157. "path",
  158. {
  159. fill: "#22ac38",
  160. d: "M9.271 14.669a.661.661 0 0 1-.88-.269l-.043-.095l-1.818-3.998a.473.473 0 0 1 0-.146a.327.327 0 0 1 .335-.327a.305.305 0 0 1 .196.066l2.18 1.527a.988.988 0 0 0 .546.167a.894.894 0 0 0 .342-.066l10.047-4.5a10.73 10.73 0 0 0-8.171-3.526C6.479 3.502 2 7.232 2 11.87a7.83 7.83 0 0 0 3.46 6.296a.662.662 0 0 1 .24.727l-.45 1.701a.945.945 0 0 0-.051.24a.327.327 0 0 0 .334.334a.416.416 0 0 0 .19-.058l2.18-1.265c.16-.098.343-.151.53-.152c.1 0 .198.014.292.043c1.062.3 2.16.452 3.264.45c5.525 0 10.011-3.729 10.011-8.33a7.228 7.228 0 0 0-1.098-3.883L9.351 14.625z"
  161. }
  162. )
  163. ]
  164. }
  165. );
  166. }
  167. function RiAlipayFill(props) {
  168. return /* @__PURE__ */ u$1(
  169. "svg",
  170. {
  171. xmlns: "http://www.w3.org/2000/svg",
  172. width: "1em",
  173. height: "1em",
  174. viewBox: "0 0 24 24",
  175. ...props,
  176. children: [
  177. props.title && /* @__PURE__ */ u$1("title", { children: props.title }),
  178. /* @__PURE__ */ u$1(
  179. "path",
  180. {
  181. fill: "#027aff",
  182. d: "M21.422 15.358c-3.83-1.153-6.055-1.84-6.678-2.062a12.41 12.41 0 0 0 1.32-3.32H12.8V8.872h4v-.68h-4V6.344h-1.536c-.28 0-.312.248-.312.248v1.592H7.2v.68h3.752v1.104H7.88v.616h6.224a10.972 10.972 0 0 1-.888 2.176c-1.408-.464-2.192-.784-3.912-.944c-3.256-.312-4.008 1.48-4.128 2.576C5 16.064 6.48 17.424 8.688 17.424s3.68-1.024 5.08-2.72c1.167.558 3.338 1.525 6.514 2.902A9.99 9.99 0 0 1 12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10a9.983 9.983 0 0 1-.578 3.358m-12.99 1.01c-2.336 0-2.704-1.48-2.584-2.096c.12-.616.8-1.416 2.104-1.416c1.496 0 2.832.384 4.44 1.16c-1.136 1.48-2.52 2.352-3.96 2.352"
  183. }
  184. )
  185. ]
  186. }
  187. );
  188. }
  189. function RiCheckboxCircleFill(props) {
  190. return /* @__PURE__ */ u$1(
  191. "svg",
  192. {
  193. xmlns: "http://www.w3.org/2000/svg",
  194. width: "1em",
  195. height: "1em",
  196. viewBox: "0 0 24 24",
  197. ...props,
  198. children: [
  199. props.title && /* @__PURE__ */ u$1("title", { children: props.title }),
  200. /* @__PURE__ */ u$1(
  201. "path",
  202. {
  203. fill: "#81c784",
  204. d: "M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m-.997-6l7.07-7.071l-1.413-1.414l-5.657 5.657l-2.829-2.829l-1.414 1.414z"
  205. }
  206. )
  207. ]
  208. }
  209. );
  210. }
  211. function RiErrorWarningFill(props) {
  212. return /* @__PURE__ */ u$1(
  213. "svg",
  214. {
  215. xmlns: "http://www.w3.org/2000/svg",
  216. width: "1em",
  217. height: "1em",
  218. viewBox: "0 0 24 24",
  219. ...props,
  220. children: [
  221. props.title && /* @__PURE__ */ u$1("title", { children: props.title }),
  222. /* @__PURE__ */ u$1(
  223. "path",
  224. {
  225. fill: "#e57373",
  226. d: "M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m-1-7v2h2v-2zm0-8v6h2V7z"
  227. }
  228. )
  229. ]
  230. }
  231. );
  232. }
  233. function RiQuestionFill(props) {
  234. return /* @__PURE__ */ u$1(
  235. "svg",
  236. {
  237. xmlns: "http://www.w3.org/2000/svg",
  238. width: "1em",
  239. height: "1em",
  240. viewBox: "0 0 24 24",
  241. ...props,
  242. children: [
  243. props.title && /* @__PURE__ */ u$1("title", { children: props.title }),
  244. /* @__PURE__ */ u$1(
  245. "path",
  246. {
  247. fill: "currentColor",
  248. d: "M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m-1-7v2h2v-2zm2-1.645A3.502 3.502 0 0 0 12 6.5a3.501 3.501 0 0 0-3.433 2.813l1.962.393A1.5 1.5 0 1 1 12 11.5a1 1 0 0 0-1 1V14h2z"
  249. }
  250. )
  251. ]
  252. }
  253. );
  254. }
  255. function TablerTableDown(props) {
  256. return /* @__PURE__ */ u$1(
  257. "svg",
  258. {
  259. xmlns: "http://www.w3.org/2000/svg",
  260. width: "1em",
  261. height: "1em",
  262. viewBox: "0 0 24 24",
  263. ...props,
  264. children: [
  265. props.title && /* @__PURE__ */ u$1("title", { children: props.title }),
  266. /* @__PURE__ */ u$1(
  267. "path",
  268. {
  269. fill: "none",
  270. stroke: "currentColor",
  271. "stroke-linecap": "round",
  272. "stroke-linejoin": "round",
  273. "stroke-width": "2",
  274. d: "M12.5 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v7.5M3 10h18M10 3v18m9-5v6m3-3l-3 3l-3-3"
  275. }
  276. )
  277. ]
  278. }
  279. );
  280. }
  281. function RiRefreshLine(props) {
  282. return /* @__PURE__ */ u$1(
  283. "svg",
  284. {
  285. xmlns: "http://www.w3.org/2000/svg",
  286. width: "1em",
  287. height: "1em",
  288. viewBox: "0 0 24 24",
  289. ...props,
  290. children: [
  291. props.title && /* @__PURE__ */ u$1("title", { children: props.title }),
  292. /* @__PURE__ */ u$1(
  293. "path",
  294. {
  295. fill: "currentColor",
  296. d: "M5.463 4.433A9.961 9.961 0 0 1 12 2c5.523 0 10 4.477 10 10c0 2.136-.67 4.116-1.81 5.74L17 12h3A8 8 0 0 0 6.46 6.228zm13.074 15.134A9.961 9.961 0 0 1 12 22C6.477 22 2 17.523 2 12c0-2.136.67-4.116 1.81-5.74L7 12H4a8 8 0 0 0 13.54 5.772z"
  297. }
  298. )
  299. ]
  300. }
  301. );
  302. }
  303. function RiAppStoreLine(props) {
  304. return /* @__PURE__ */ u$1(
  305. "svg",
  306. {
  307. xmlns: "http://www.w3.org/2000/svg",
  308. width: "1em",
  309. height: "1em",
  310. viewBox: "0 0 24 24",
  311. ...props,
  312. children: /* @__PURE__ */ u$1(
  313. "path",
  314. {
  315. fill: "currentColor",
  316. d: "M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2m0 2a8 8 0 1 0 0 16a8 8 0 0 0 0-16M8.823 15.343l-.79 1.37a.823.823 0 1 1-1.428-.822l.589-1.016q.989-.307 1.629.468M13.21 8.66l2.423 4.194h2.141a.82.82 0 0 1 .823.822a.82.82 0 0 1-.823.823h-1.19l.803 1.391a.824.824 0 0 1-1.427.823l-3.04-5.266c-.69-1.19-.198-2.383.29-2.787m.278-3.044c.395.226.528.73.302 1.125l-3.528 6.109h2.553c.826 0 1.29.972.931 1.645h-7.48a.82.82 0 0 1-.822-.823a.82.82 0 0 1 .822-.822h2.097l2.685-4.653l-.838-1.456a.824.824 0 0 1 1.427-.823l.359.633l.367-.633a.823.823 0 0 1 1.125-.302"
  317. }
  318. )
  319. }
  320. );
  321. }
  322. const CalcButton = (props) => {
  323. let childs = preact.toChildArray(props.children);
  324. if (props.isLoading) {
  325. if (childs.length > 0 && preact.isValidElement(childs[0])) {
  326. childs = [/* @__PURE__ */ u$1(SvgSpinners180RingWithBg, {})];
  327. } else {
  328. childs.unshift(/* @__PURE__ */ u$1(SvgSpinners180RingWithBg, {}));
  329. }
  330. }
  331. return /* @__PURE__ */ u$1("button", { type: props.type ?? "button", ...props, children: childs });
  332. };
  333. CalcButton.Group = (props) => {
  334. return /* @__PURE__ */ u$1("div", { className: "calcBtnGroup", ...props });
  335. };
  336. const PaymentMethod = ({ method }) => {
  337. switch (method) {
  338. case "支付宝":
  339. case "支付宝扫码":
  340. return /* @__PURE__ */ u$1(RiAlipayFill, { title: "支付宝" });
  341. case "微信":
  342. case "微信扫码":
  343. return /* @__PURE__ */ u$1(RiWechatPayFill, { title: "微信支付" });
  344. case "苹果IAP":
  345. return /* @__PURE__ */ u$1(RiAppStoreLine, { title: "苹果IAP" });
  346. default:
  347. return /* @__PURE__ */ u$1(RiQuestionFill, { title: method });
  348. }
  349. };
  350. const ReportTable = (props) => {
  351. var _a;
  352. return /* @__PURE__ */ u$1("div", { className: "reportTable", children: /* @__PURE__ */ u$1("table", { children: [
  353. /* @__PURE__ */ u$1("thead", { children: /* @__PURE__ */ u$1("tr", { children: [
  354. /* @__PURE__ */ u$1("th", { children: "时间" }),
  355. /* @__PURE__ */ u$1("th", { children: "游戏" }),
  356. /* @__PURE__ */ u$1("th", { children: "订单号" }),
  357. /* @__PURE__ */ u$1("th", { children: "价格" }),
  358. /* @__PURE__ */ u$1("th", { children: "支付状态" })
  359. ] }) }),
  360. /* @__PURE__ */ u$1("tbody", { children: (_a = props.data) == null ? void 0 : _a.map((charge) => /* @__PURE__ */ u$1("tr", { children: [
  361. /* @__PURE__ */ u$1("td", { children: charge.time }),
  362. /* @__PURE__ */ u$1("td", { children: charge.game }),
  363. /* @__PURE__ */ u$1("td", { children: charge.orderId }),
  364. /* @__PURE__ */ u$1("td", { children: charge.price }),
  365. /* @__PURE__ */ u$1("td", { children: [
  366. /* @__PURE__ */ u$1(PaymentMethod, { method: charge.paymentMethod }),
  367. " ",
  368. charge.status ? /* @__PURE__ */ u$1(RiCheckboxCircleFill, {}) : /* @__PURE__ */ u$1(RiErrorWarningFill, {})
  369. ] })
  370. ] }, charge.orderId)) })
  371. ] }) });
  372. };
  373. var t, r, u, i, o = 0, f = [], c = [], e = preact.options.__b, a = preact.options.__r, v = preact.options.diffed, l = preact.options.__c, m = preact.options.unmount;
  374. function d(t2, u2) {
  375. preact.options.__h && preact.options.__h(r, t2, o || u2), o = 0;
  376. var i2 = r.__H || (r.__H = { __: [], __h: [] });
  377. return t2 >= i2.__.length && i2.__.push({ __V: c }), i2.__[t2];
  378. }
  379. function h(n) {
  380. return o = 1, s(B, n);
  381. }
  382. function s(n, u2, i2) {
  383. var o2 = d(t++, 2);
  384. if (o2.t = n, !o2.__c && (o2.__ = [i2 ? i2(u2) : B(void 0, u2), function(n2) {
  385. var t2 = o2.__N ? o2.__N[0] : o2.__[0], r2 = o2.t(t2, n2);
  386. t2 !== r2 && (o2.__N = [r2, o2.__[1]], o2.__c.setState({}));
  387. }], o2.__c = r, !r.u)) {
  388. var f2 = function(n2, t2, r2) {
  389. if (!o2.__c.__H)
  390. return true;
  391. var u3 = o2.__c.__H.__.filter(function(n3) {
  392. return n3.__c;
  393. });
  394. if (u3.every(function(n3) {
  395. return !n3.__N;
  396. }))
  397. return !c2 || c2.call(this, n2, t2, r2);
  398. var i3 = false;
  399. return u3.forEach(function(n3) {
  400. if (n3.__N) {
  401. var t3 = n3.__[0];
  402. n3.__ = n3.__N, n3.__N = void 0, t3 !== n3.__[0] && (i3 = true);
  403. }
  404. }), !(!i3 && o2.__c.props === n2) && (!c2 || c2.call(this, n2, t2, r2));
  405. };
  406. r.u = true;
  407. var c2 = r.shouldComponentUpdate, e2 = r.componentWillUpdate;
  408. r.componentWillUpdate = function(n2, t2, r2) {
  409. if (this.__e) {
  410. var u3 = c2;
  411. c2 = void 0, f2(n2, t2, r2), c2 = u3;
  412. }
  413. e2 && e2.call(this, n2, t2, r2);
  414. }, r.shouldComponentUpdate = f2;
  415. }
  416. return o2.__N || o2.__;
  417. }
  418. function b() {
  419. for (var t2; t2 = f.shift(); )
  420. if (t2.__P && t2.__H)
  421. try {
  422. t2.__H.__h.forEach(k), t2.__H.__h.forEach(w), t2.__H.__h = [];
  423. } catch (r2) {
  424. t2.__H.__h = [], preact.options.__e(r2, t2.__v);
  425. }
  426. }
  427. preact.options.__b = function(n) {
  428. r = null, e && e(n);
  429. }, preact.options.__r = function(n) {
  430. a && a(n), t = 0;
  431. var i2 = (r = n.__c).__H;
  432. i2 && (u === r ? (i2.__h = [], r.__h = [], i2.__.forEach(function(n2) {
  433. n2.__N && (n2.__ = n2.__N), n2.__V = c, n2.__N = n2.i = void 0;
  434. })) : (i2.__h.forEach(k), i2.__h.forEach(w), i2.__h = [], t = 0)), u = r;
  435. }, preact.options.diffed = function(t2) {
  436. v && v(t2);
  437. var o2 = t2.__c;
  438. o2 && o2.__H && (o2.__H.__h.length && (1 !== f.push(o2) && i === preact.options.requestAnimationFrame || ((i = preact.options.requestAnimationFrame) || j)(b)), o2.__H.__.forEach(function(n) {
  439. n.i && (n.__H = n.i), n.__V !== c && (n.__ = n.__V), n.i = void 0, n.__V = c;
  440. })), u = r = null;
  441. }, preact.options.__c = function(t2, r2) {
  442. r2.some(function(t3) {
  443. try {
  444. t3.__h.forEach(k), t3.__h = t3.__h.filter(function(n) {
  445. return !n.__ || w(n);
  446. });
  447. } catch (u2) {
  448. r2.some(function(n) {
  449. n.__h && (n.__h = []);
  450. }), r2 = [], preact.options.__e(u2, t3.__v);
  451. }
  452. }), l && l(t2, r2);
  453. }, preact.options.unmount = function(t2) {
  454. m && m(t2);
  455. var r2, u2 = t2.__c;
  456. u2 && u2.__H && (u2.__H.__.forEach(function(n) {
  457. try {
  458. k(n);
  459. } catch (n2) {
  460. r2 = n2;
  461. }
  462. }), u2.__H = void 0, r2 && preact.options.__e(r2, u2.__v));
  463. };
  464. var g = "function" == typeof requestAnimationFrame;
  465. function j(n) {
  466. var t2, r2 = function() {
  467. clearTimeout(u2), g && cancelAnimationFrame(t2), setTimeout(n);
  468. }, u2 = setTimeout(r2, 100);
  469. g && (t2 = requestAnimationFrame(r2));
  470. }
  471. function k(n) {
  472. var t2 = r, u2 = n.__c;
  473. "function" == typeof u2 && (n.__c = void 0, u2()), r = t2;
  474. }
  475. function w(n) {
  476. var t2 = r;
  477. n.__c = n.__(), r = t2;
  478. }
  479. function B(n, t2) {
  480. return "function" == typeof t2 ? t2(n) : t2;
  481. }
  482. const DateTimeRangePicker = (props) => {
  483. const [timeStart, setTimeStart] = h(props.start ?? /* @__PURE__ */ new Date());
  484. const [timeEnd, setTimeEnd] = h(props.end ?? /* @__PURE__ */ new Date());
  485. return /* @__PURE__ */ u$1("div", { className: "dateTimeRange", children: [
  486. /* @__PURE__ */ u$1(
  487. "input",
  488. {
  489. type: "datetime-local",
  490. max: props.end && (timeEnd < props.end ? timeEnd : props.end).toISOString().slice(0, -8),
  491. value: timeStart.toISOString().slice(0, -8),
  492. onChange: (e2) => setTimeStart(new Date(e2.target.value))
  493. }
  494. ),
  495. /* @__PURE__ */ u$1(
  496. "input",
  497. {
  498. type: "datetime-local",
  499. min: props.start && (timeStart > props.start ? timeStart : props.start).toISOString().slice(0, -8),
  500. value: timeEnd.toISOString().slice(0, -8),
  501. onChange: (e2) => setTimeEnd(new Date(e2.target.value))
  502. }
  503. )
  504. ] });
  505. };
  506. const ReportForm = (props) => {
  507. var _a, _b;
  508. const [isShow, setShowState] = h(false);
  509. const handleXlsx = () => {
  510. const schema = [
  511. {
  512. column: "时间",
  513. type: String,
  514. width: 16.8,
  515. value: (c2) => c2.time
  516. },
  517. {
  518. column: "游戏",
  519. type: String,
  520. width: 10,
  521. value: (c2) => c2.game
  522. },
  523. {
  524. column: "订单号",
  525. type: Number,
  526. width: 10,
  527. value: (c2) => c2.orderId
  528. },
  529. {
  530. column: "价格",
  531. type: Number,
  532. value: (c2) => c2.price
  533. },
  534. {
  535. column: "支付方式",
  536. type: String,
  537. value: (c2) => c2.paymentMethod
  538. },
  539. {
  540. column: "支付状态",
  541. type: Boolean,
  542. value: (c2) => c2.status
  543. }
  544. ];
  545. if (props.data) {
  546. writeXlsxFile(props.data, { schema, fileName: `PW_ChargeAnalysis-${Date.now()}.xlsx` });
  547. }
  548. };
  549. return /* @__PURE__ */ u$1(preact.Fragment, { children: [
  550. /* @__PURE__ */ u$1(
  551. "button",
  552. {
  553. title: "显示报表",
  554. type: "button",
  555. className: "reportTriggerBtn",
  556. onClick: () => {
  557. setShowState(!isShow);
  558. },
  559. children: /* @__PURE__ */ u$1(RiLineChartLine, {})
  560. }
  561. ),
  562. /* @__PURE__ */ u$1("div", { className: `reportPanel${isShow ? "" : "_hide"}`, children: [
  563. /* @__PURE__ */ u$1("div", { className: "reportPanelData", children: [
  564. /* @__PURE__ */ u$1(DateTimeRangePicker, { start: /* @__PURE__ */ new Date("2023-12-1") }),
  565. /* @__PURE__ */ u$1(ReportTable, { data: props.data })
  566. ] }),
  567. /* @__PURE__ */ u$1("div", { className: "reportPanelStats", children: /* @__PURE__ */ u$1("h1", { children: "Title" }) }),
  568. /* @__PURE__ */ u$1("div", { className: "statsPanel", children: /* @__PURE__ */ u$1("ul", { children: [
  569. /* @__PURE__ */ u$1("li", { children: [
  570. /* @__PURE__ */ u$1("strong", { children: "总计: " }),
  571. (_a = props.data) == null ? void 0 : _a.reduce((j2, k2) => j2 + k2.price, 0)
  572. ] }),
  573. /* @__PURE__ */ u$1("li", { children: [
  574. /* @__PURE__ */ u$1("strong", { children: "最贵一笔: " }),
  575. (_b = props.data) == null ? void 0 : _b.reduce(
  576. (max, item) => item.price > max ? item.price : max,
  577. 0
  578. )
  579. ] })
  580. ] }) }),
  581. /* @__PURE__ */ u$1("div", { className: "floatingButtons", children: [
  582. /* @__PURE__ */ u$1("button", { type: "button", title: "刷新", children: /* @__PURE__ */ u$1(RiRefreshLine, {}) }),
  583. /* @__PURE__ */ u$1("button", { type: "button", title: "下载表格", onClick: handleXlsx, children: /* @__PURE__ */ u$1(TablerTableDown, {}) }),
  584. /* @__PURE__ */ u$1("button", { type: "button", title: "打开设置", children: /* @__PURE__ */ u$1(RiSettingsLine, {}) })
  585. ] })
  586. ] })
  587. ] });
  588. };
  589. function App() {
  590. var _a, _b, _c;
  591. const lastPage = parseInt(
  592. (_c = (_b = (_a = document.querySelector(".fansPage.mt30")) == null ? void 0 : _a.lastChild) == null ? void 0 : _b.previousSibling) == null ? void 0 : _c.textContent
  593. );
  594. const [data, setData] = h([]);
  595. const [loadingState, setLoadingState] = h(false);
  596. const fetchChargeHist = async () => {
  597. try {
  598. const fetchPromises = Array.from({ length: lastPage }, async (_, i2) => {
  599. const response = await fetch(
  600. `https://${window.location.host}/billing/chargeDetailRecord/-1/-1/1/${i2 + 1}`,
  601. { credentials: "include" }
  602. );
  603. if (!response.ok) {
  604. throw new Error(`请求数据出错: ${response.statusText}`);
  605. }
  606. const responseText = await response.text();
  607. const doc = new DOMParser().parseFromString(responseText, "text/html");
  608. const paidHistTable = Array.from(
  609. doc.querySelectorAll(
  610. "#mainWrap > div > div.fr.w705 > div.t.f12.mt30 > table > tbody tr"
  611. )
  612. );
  613. let currentPrice = 0;
  614. paidHistTable.forEach((row) => {
  615. const [time, game, orderIdStr, priceStr, paymentMethod, statusText] = Array.from(row.querySelectorAll("td")).map(
  616. (td) => {
  617. var _a2;
  618. return (_a2 = td.textContent) == null ? void 0 : _a2.trim();
  619. }
  620. );
  621. const orderId = parseInt(orderIdStr);
  622. const price = parseInt(priceStr.slice(1));
  623. const status = statusText === "付款成功" ? true : false;
  624. data.push({ time, game, orderId, price, paymentMethod, status });
  625. currentPrice += price;
  626. });
  627. console.log(`第${i2 + 1}页 爆了 ${currentPrice} 金币`);
  628. });
  629. await Promise.all(fetchPromises);
  630. } catch (error) {
  631. console.error("请求数据出错:", error);
  632. throw error;
  633. }
  634. };
  635. return /* @__PURE__ */ u$1("div", { className: "hmdyp", children: [
  636. /* @__PURE__ */ u$1(CalcButton.Group, { children: [
  637. /* @__PURE__ */ u$1(
  638. CalcButton,
  639. {
  640. title: "简单计算",
  641. onClick: async () => {
  642. if (data.length === 0) {
  643. setLoadingState(true);
  644. fetchChargeHist().then(() => console.log(data)).then(() => setLoadingState(false));
  645. } else {
  646. console.log(data);
  647. }
  648. },
  649. isLoading: loadingState,
  650. children: /* @__PURE__ */ u$1(CryptocurrencyColorBtc, {})
  651. }
  652. ),
  653. /* @__PURE__ */ u$1(CalcButton, { isLoading: loadingState, children: "金币爆几何?" })
  654. ] }),
  655. data.length ? /* @__PURE__ */ u$1(ReportForm, { data }) : void 0
  656. ] });
  657. }
  658. const serPayBox = document.querySelector(".serPayBox.f12.cl");
  659. const calcMain = document.createElement("div");
  660. serPayBox == null ? void 0 : serPayBox.appendChild(calcMain);
  661. preact.render(/* @__PURE__ */ u$1(App, {}), calcMain);
  662.  
  663. })(preact, writeXlsxFile);