GithubHelp home page GithubHelp logo

bill_statistics's Introduction

前言

毕业以来一直有统计账单的习惯,最开始用「会记账」App 并且一直更新到微博 https://weibo.com/u/2038777590 ,目前 App 已经停止运行了,后来也因为原因也就没再统计。 会记账App页面 一直想用一个账单软件,从支付宝和微信账单拉取信息统计,又怕第三方的不太安全。索性自己就写了一个,GitHub 地址:https://github.com/liangtongzhuo/bill_statistics

目录

    1. 数据来源
    1. 数据读取
    1. 数据汇总保存
    1. 数据页面保存
    1. 项目 GitHub 地址

1. 数据来源

微信数据:我-支付-钱包-账单-常见问题-下载账单-输入到邮箱即可 微信账单如图:

支付宝数据:打开Web页面登录-交易记录-选择时间-下载excel

2. 数据读取

const csv = require('csv-parser')
const fs = require('fs')


/**
 * csv 解析封装
 * @param {*} path csv路径
 */
module.exports.readcsv = (path) => {
  return new Promise((resolve, rejects) => {
    const results = [];
    fs.createReadStream(path)
      .pipe(csv())
      .on('data', (data) => results.push(data))
      .on('end', () => {
        resolve(results)
      }).on('error', (error) => {
        rejects(error)
      })
  })
}

3. 数据汇总保存

JSON 格式保存本地

/**
 * 保存数据到本地
 */
module.exports.dbSave = (name) => {
  fs.writeFileSync(`${dbPath}_${name}`, JSON.stringify(db));
}

4. 数据页面保存

根据数据生成HTML静态页面

5. 项目地址

https://github.com/liangtongzhuo/bill_statistics

文件目录

  • db:存放从微信和支付宝账单读取账单的文件
  • in_html: 默认模版,可用浏览器打开
  • order:原始支付宝和微信账单位置
  • statistics:根据数据生成 HTML 的逻辑
  • out_html:根据数据生成后的HTML,可用浏览器打开
  • util:工具
  • index:执行入口
  • config:配置文件,统计分类
npm i
node index #生成数据
node ./statistics/statistics_month.js #生成Web页面

bill_statistics's People

Contributors

liangtongzhuo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

tuin77

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.