-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
72 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { App } from '#components' | ||
import { api } from '#models' | ||
import _ from 'lodash' | ||
|
||
const appInfo = { | ||
id: 'expend', | ||
name: '支出' | ||
} | ||
|
||
const rule = { | ||
total: { | ||
reg: App.getReg('总?(支出|消费|花费)'), | ||
cfg: { | ||
accessToken: true, | ||
tip: true | ||
}, | ||
fnc: async (e, { cookie }) => { | ||
const html = await api.store.AjaxLoadMoreHistory(cookie) | ||
if (!html) { | ||
return '获取失败或消费为空' | ||
} | ||
let currency | ||
const data = html.replace(/[\n\t]/g, '').split('</tr>').filter(i => !/(退款|wht_refunded|钱包<)/.test(i)).map(i => { | ||
const reg = /<td\s*class="wht_total\s*">([\s\S]+?)<\/td>/ | ||
const regRet = reg.exec(i) | ||
if (regRet) { | ||
const res = regRet[1].split(' ') | ||
currency = res[0] | ||
return parseFloat(res[1]) || 0 | ||
} | ||
return 0 | ||
}) | ||
const total = _.sum(data) | ||
return `在steam消费了${currency} ${total.toFixed(2)}\n数据来源: 由 客服 -> 购买消费 -> 查看完整的购买记录 计算而来 仅供参考` | ||
} | ||
} | ||
} | ||
|
||
export const app = new App(appInfo, rule).create() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters