npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

easybx

v2.0.0

Published

让报销变的轻松一点

Readme

easybx

简化报销流程,指定报销周期,根据钉钉打卡记录获取加班日数据,爬取支付宝获取加班日支付宝消费数据,并生成账单

其实现原理可分为以下步骤:

  1. 根据钉钉打卡表获取加班日期数据
  2. 爬取支付宝账单,需设置账单起始日期、单日账单时间区间以及账单价格区间
  3. 根据 1、2 两步骤获取的结果,筛选加班日指定账单时间区间以及账单价格区间的消费数据,并分析得到加班日消费数据
  4. 数据需要肉眼查别是否是你需要的数据

Install

$ npm install easybx

Usage

项目根目录下创建 bx.config.js 文件,该文件需要导出一个配置对象:

module.exports = {
  startDate: '2018-11-11',
  endDate: '2018-12-12',
  excels: [],
  ddkqOptions: {},
  zfbzdOptions: {},
  sorting: 'desc'
}

一次性运行:

const { gBx } = require('easybx')

;(async function() {
  let data = await gBx()
})()

程序更加可控的分阶段运行:

const { gExcel, gAlipay, gGenerate } = require('easybx')

;(async function() {
  const overtime_data = gExcel()
  const cost_data = await gAlipay()
  const data = gGenerate(overtime_data, cost_data)
})()

bx.config.js 配置项

startDate

必填

此次报销周期开始时间,格式 yyyy-mm-dd

endDate

必填

此次报销周期结束时间,格式 yyyy-mm-dd

excels

必填

ddqk.getTimeOverexcels 选项配置,具体说明可以看 这里

excels 打卡时间应包含报销周期,即 [startDate, endDate] 的日期是 excels 日期数组的子集

ddkqOptions

选填

ddqk.getTimeOver API 的 config 选项配置,具体配置项可以看 这里,以及对于 getTimeOver 的一个 额外的配置项

zfbzdOptions

必填

zfbzd 的配置项

几个需要的配置说明:

  • zfbzdOptions {Object}
    • startDate {String} 这里无需配置,自动使用 bx.config.js 中的 startDate
    • endDate {String} 这里无需配置,自动使用 bx.config.js 中的 endDate
    • billStartTime {String} 必填,单天账单报销开始区间(即会抓取该时间开始到 24:00 的账单)格式 hh:mm(默认报销结束时间 24:00,不需要手动设置)
    • maxAmount {Number} 必填,报销价格区间上限,即会抓取 [-Infinity, maxAmount] 价格区间的账单,即假设晚饭最低消费 maxAmount

sorting

选填

  • sorting {String} 可设置加班日消费数据(即 cost_data_overtime 数据)返回顺序
    • 'desc' 默认值,默认时间倒序返回,生成的 HTML 也是根据时间倒序排列
    • 'asc' 正序返回

API

gExcel

根据 bx.config.js 配置,获取加班日数据,即获取 [startDate, endDate] 中的加班日数据

  • return: {Array<Object>}

返回数据格式同 ddkq

gAlipay

根据 bx.config.js 配置,获取指定时间区间、指定单日时间区间、指定价格区间的账单信息

  • return: <Promise<Array<Object>>>

返回数据格式同 zfbzd

gGenerate(overtime_data, cost_data)

根据加班日数据和支付宝消费数据,分析得到加班日消费数据、没消费数据的加班日数组、有重复消费数据的加班日数组以及加班日消费清单的 HTML 字符串

  • overtime_data {Array<Object>} 加班数据,即 gExcel 的返回值
  • cost_data {Array<Object>} 消费数据,即 gAlipay 返回值
  • return: {Object}
    • cost_data_overtime {Array} 加班日消费数据
    • overtime_data_no_cost {Array} 没消费数据的加班日数组
    • overtime_data_repeat_cost {Array} 有重复消费数据的加班日数组
    • html {String} 加班日消费清单的 HTML 字符串

gBx

综合了 gExcelgAlipay 以及 gGenerate

  • return: <Promise<Object>>

返回数据格式同 gGenerate API

最佳实践

根据我自己的使用经验,整理了一套用于报销的 最佳实践,可直接拿来使用

需要修改的部分为:

  1. excels 最佳实践建议放在根目录下,数组值和 excel 文件名一一对应,格式 yyyy-mm
  2. 修改 startDateendDate,即该次报销区间(注意报销区间应该是 excels 时间区间的子集)
  3. 修改 zfbzdOptions.billStartTime,默认返回全部时间段账单,修改该值可以缩小返回账单时间段,我将其设置为 16:00,即假设晚饭的消费时间不会早于 16:00
  4. 修改 zfbzdOptions.maxAmount,设置账单价格区间上限,默认会返回全部价格的账单。我将其设置为 -8,即假设晚饭的消费不会少于 8 块

That's easy! 其他使用最佳实践提供的默认值即可

最后运行 run.js 即可

局限性

  1. 可能有加班日但是并没有获取到消费信息,程序会在控制台打印这些日期
  2. 可能在加班日会有重复消费,程序会在控制台打印这些日期
  3. 有些加班日的消费数据可能并不是你需要的数据,需要手动判断
  4. 无法解决第二天凌晨才点晚饭的情况,因为账单只会筛选当天

thanks to puppeteer

License

MIT