Skip to content

Commit

Permalink
♻️ (rule): 简化规则代码
Browse files Browse the repository at this point in the history
删除部分冗余代码,提高代码可读性。
  • Loading branch information
AnkioTomas committed Sep 30, 2024
1 parent cdb69f0 commit 27b4445
Show file tree
Hide file tree
Showing 43 changed files with 40 additions and 134 deletions.
1 change: 0 additions & 1 deletion src/category/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { BillType, isTimeInRange } from 'common/index.js';


function getLevel2 (category) {
switch (category) {
case '三餐':
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { BillType, Currency, formatDate, RuleObject, toFloat } from 'common/index.js';



import { BillType, Currency, RuleObject, toFloat } from 'common/index.js';

export function get(data) {
let json = JSON.parse(data)
Expand Down
3 changes: 2 additions & 1 deletion src/rule/cmb.pb/notice/招商银行入账通知/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BillType, Currency, formatDate, RuleObject, toFloat } from 'common/index.js';
import { BillType, Currency, RuleObject, toFloat } from 'common/index.js';

// {"title":"招商银行","text":"您尾号6598的招行一卡通入账人民币1442.00元",t}
export function get(data) {
let json = JSON.parse(data)
Expand Down
3 changes: 1 addition & 2 deletions src/rule/cmb.pb/notice/招商银行消费通知/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { AliTools, BillType, Currency, formatDate, RuleObject, toFloat } from 'common/index.js';

import { BillType, Currency, formatDate, RuleObject, toFloat } from 'common/index.js';

// 您账户6598于09月19日08:46在【财付通-理财通-腾安基金销售(深圳)有限公司】发生快捷支付扣款,人民币2500.00

Expand Down
1 change: 1 addition & 0 deletions src/rule/com.android.phone/app/短信广东农信/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BillType, Currency, formatDate, RuleObject, splitSms, toFloat } from 'common/index.js';

export function get(data) {
let { sender,bankName,text,t } = splitSms(data);
if (bankName !== "广东农信") return null;
Expand Down
1 change: 1 addition & 0 deletions src/rule/com.android.phone/app/短信招商银行/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BillType, Currency, formatDate, RuleObject, splitSms, toFloat } from 'common/index.js';

export function get(data) {
let { sender,bankName,text,t } = splitSms(data);
if (bankName !== "招商银行") return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import { AliTools, RuleObject, toFloat } from 'common/index.js';




import { RuleObject, toFloat } from 'common/index.js';

export function get(data) {
let json = JSON.parse(data)[0];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { BillType, RuleObject, toFloat } from 'common/index.js';


function income(pl,t){
let obj = new RuleObject(BillType.Income);
obj.money = toFloat(pl.content);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { BillType, RuleObject, toFloat } from 'common/index.js';




export function get(data) {
let json = JSON.parse(data)[0];
let pl = JSON.parse(json.pl);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { AliTools, BillType, RuleObject, toFloat } from 'common/index.js';



function income(pl,t){
let obj = new RuleObject(BillType.Income);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { AliTools, BillType, formatDate, RuleObject, toFloat } from 'common/index.js';

import { BillType, formatDate, RuleObject, toFloat } from 'common/index.js';

// 您账户6598于09月19日08:46在【财付通-理财通-腾安基金销售(深圳)有限公司】发生快捷支付扣款,人民币2500.00

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BillType, Currency, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';
import { BillType, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE = '中国农业银行微银行';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BillType, Currency, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';
import { BillType, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE = '中国银行微银行';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BillType, Currency, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';
import { BillType, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE = '交通银行微银行';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BillType, Currency, formatDate, parseWechat, RuleObject, toFloat } from 'common/index.js';
import { BillType, Currency, parseWechat, RuleObject, toFloat } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE = '京东购物';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BillType, Currency, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';
import { BillType, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE = '保定银行';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BillType, Currency, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';
import { BillType, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE = '兴业银行';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BillType, Currency, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';
import { BillType, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE = '四川农信';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BillType, Currency, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';
import { BillType, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE = '平安银行';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BillType, Currency, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';
import { BillType, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';

const SOURCE_NAME = '平安银行信用卡';
const TITLE = ['消费成功通知'];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BillType, Currency, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';
import { BillType, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';

const SOURCE_NAME = '广东粤通卡ETC服务';
const TITLE = ['高速通行通知'];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BillType, Currency, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';
import { BillType, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE = '广发信用卡';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BillType, formatDate, RuleObject, toFloat, findNonEmptyString, parseWechat } from 'common/index.js';
import { BillType, formatDate, parseWechat, RuleObject, toFloat } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE = '微信收款助手';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BillType, Currency, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';
import { BillType, Currency, formatDate, parseWechat, RuleObject, toFloat } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE = '徽商银行';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BillType, Currency, formatDate, parseWechat, RuleObject, transferCurrency } from 'common/index.js';
import { BillType, formatDate, parseWechat, RuleObject, transferCurrency } from 'common/index.js';

const SOURCE_NAME = '招商银行信用卡';
const TITLE = ['交易成功提醒', '自动还款到账提醒','还款提醒'];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BillType, Currency, formatDate, parseWechat, RuleObject } from 'common/index.js';

const SOURCE_NAME = '收钱吧福利社';
const TITLE = ['交易完成通知'];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BillType, Currency, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';
import { BillType, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE = '日照银行';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BillType, Currency, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';
import { BillType, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE = '浦发银行信用卡';
Expand Down
11 changes: 1 addition & 10 deletions src/rule/com.tencent.mm/app/微信支付二维码收款/main.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
import {
BillType,
Currency,
formatDate,
RuleObject,
toFloat,
findNonEmptyString,
parseWechat,
transferCurrency
} from 'common/index.js';
import { BillType, findNonEmptyString, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE_NAME_WECHAT = '微信支付';
Expand Down
2 changes: 1 addition & 1 deletion src/rule/com.tencent.mm/app/微信支付亲属卡/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BillType, Currency, formatDate, RuleObject, toFloat, findNonEmptyString, parseWechat } from 'common/index.js';
import { BillType, Currency, findNonEmptyString, formatDate, parseWechat, RuleObject, toFloat } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE_NAME_WECHAT = '微信支付';
Expand Down
11 changes: 1 addition & 10 deletions src/rule/com.tencent.mm/app/微信支付商家打款/main.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
import {
BillType,
Currency,
formatDate,
RuleObject,
toFloat,
findNonEmptyString,
parseWechat,
transferCurrency
} from 'common/index.js';
import { BillType, findNonEmptyString, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE_NAME_WECHAT = '微信支付';
Expand Down
11 changes: 1 addition & 10 deletions src/rule/com.tencent.mm/app/微信支付商家退款/main.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
import {
BillType,
Currency,
formatDate,
RuleObject,
toFloat,
findNonEmptyString,
parseWechat,
transferCurrency
} from 'common/index.js';
import { BillType, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE_NAME_WECHAT = '微信支付';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BillType, Currency, formatDate, RuleObject, toFloat, findNonEmptyString, parseWechat } from 'common/index.js';
import { BillType, Currency, parseWechat, RuleObject, toFloat } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE_NAME_WECHAT = '微信支付';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BillType, Currency, formatDate, RuleObject, toFloat, findNonEmptyString, parseWechat } from 'common/index.js';
import { BillType, Currency, parseWechat, RuleObject, toFloat } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE_NAME_WECHAT = '微信支付';
Expand Down
11 changes: 1 addition & 10 deletions src/rule/com.tencent.mm/app/微信支付收款入账/main.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
import {
BillType,
Currency,
formatDate,
RuleObject,
toFloat,
findNonEmptyString,
parseWechat,
transferCurrency
} from 'common/index.js';
import { BillType, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE_NAME_WECHAT = '微信支付';
Expand Down
9 changes: 1 addition & 8 deletions src/rule/com.tencent.mm/app/微信支付经营收款/main.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import {
BillType,
Currency,
RuleObject,
toFloat,
parseWechat,
transferCurrency
} from 'common/index.js';
import { BillType, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE_NAME_WECHAT = '微信支付';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BillType, Currency, formatDate, RuleObject, toFloat, findNonEmptyString, parseWechat } from 'common/index.js';
import { BillType, Currency, findNonEmptyString, parseWechat, RuleObject, toFloat } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE_NAME_WECHAT = '微信支付';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
import {
BillType,
Currency,
formatDate,
RuleObject,
toFloat,
findNonEmptyString,
parseWechat,
transferCurrency
} from 'common/index.js';
import { BillType, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE_NAME_WECHAT = '微信支付';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
import {
BillType,
Currency,
formatDate,
RuleObject,
toFloat,
parseWechat,
transferCurrency
} from 'common/index.js';
import { BillType, formatDate, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE_NAME_WECHAT = '微信支付';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
import {
BillType,
Currency,
formatDate,
RuleObject,
toFloat,
findNonEmptyString,
parseWechat,
transferCurrency
} from 'common/index.js';
import { BillType, parseWechat, RuleObject, toFloat, transferCurrency } from 'common/index.js';

// 定义源名称和需要匹配的标题数组
const SOURCE_NAME_WECHAT = '微信支付';
Expand Down
12 changes: 1 addition & 11 deletions src/rule/com.tencent.mm/app/微信红包收款/main.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
import {
BillType,
Currency,
formatDate,
RuleObject,
findNonEmptyString,
parseWechat,
toDoubleFloat
} from 'common/index.js';


import { BillType, Currency, RuleObject, toDoubleFloat } from 'common/index.js';

/**
* 获取规则对象
Expand Down
5 changes: 1 addition & 4 deletions src/rule/com.tencent.mm/notice/微信支付/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { BillType, Currency, formatDate, RuleObject, toFloat, transferCurrency } from 'common/index.js';



import { BillType, RuleObject, toFloat, transferCurrency } from 'common/index.js';

export function get(data) {
let json = JSON.parse(data)
Expand Down
2 changes: 1 addition & 1 deletion src/rule/tests.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"mMap":{"tableName":"AppMessage","description":"收款金额¥0.10\n汇总今日第1笔收款,共计¥0.10\n备注收款成功,已存入零钱。点击可查看详情","source":"微信收款助手","arg":"msgId","type":5,"appId":"","msgId":10248143,"title":"微信支付收款0.10元(老顾客到店[朋友])"}}
{"mMap":{"tableName":"AppMessage","description":"交易时间:09月26日19:05\n交易类型:电子钱包取现(尾号0464)\n交易金额:人民币 36.00\n账户余额:61.04元\n交易说明:点击查看更多详情","source":"中国银行微银行","arg":"msgId","type":5,"appId":"","msgId":385312,"title":"交易成功提醒"}}

0 comments on commit 27b4445

Please sign in to comment.