Skip to content

Commit

Permalink
✨ (短信建设银行): 新增建设银行支出短信解析功能 #617
Browse files Browse the repository at this point in the history
新增对建设银行支出短信的解析规则,包括测试用例和规则实现。支持解析短信中的支出金额、账户信息、时间等字段,并生成相应的账单对象。
  • Loading branch information
AnkioTomas committed Dec 28, 2024
1 parent 7017bf8 commit d91049d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
20 changes: 19 additions & 1 deletion src/rule/com.android.phone/app/短信建设银行/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,24 @@ const rules = [
obj.accountNameTo = `建设银行信用卡(${number})`;
return obj;
}
],
[
// 【建设银行】您尾号1546账户12月21日7时14分支出人民币30元,可用余额230.53元。附言:账户1546包年短信服务费。
/您尾号(\d{4})账户(\d{2}月\d{2}日\d{1,2}时\d{1,2}分)支出人民币(.*?)元,可用余额(.*?)元。附言:(.*?)。/,
(match, t) => {
let [, number, date, money, , shopItm] = match;

let obj = new RuleObject();

obj.money = toFloat(money);
obj.channel = `建设银行[支出]`;
obj.shopItem = shopItm;
obj.time = t;

obj.type = BillType.Expend;
obj.accountNameFrom = `建设银行(${number})`;
return obj;
}
]
];

Expand All @@ -79,4 +97,4 @@ export function get(data) {
return rule[1](match, t);
}
}
}
}
18 changes: 17 additions & 1 deletion src/rule/com.android.phone/app/短信建设银行/main.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,20 @@ test('建设银行信用卡还款', () =>
"time": formatDate("12月04日", "M月D日"),
"channel": '建设银行信用卡[还款]',
},
]));
]));

test('建设银行支出', () =>
testAnkio('建设银行支出', [
{
'type': 'Expend',
'money': 30,
'fee': 0,
'shopName': '',
'shopItem': '账户1546包年短信服务费',
'accountNameFrom': '建设银行(1546)',
'accountNameTo': '',
'currency': 'CNY',
'time': 1734739538228,
'channel': '建设银行[支出]'
}
]));
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"sender":"建设银行","body":"【建设银行】您尾号1546账户12月21日7时14分支出人民币30元,可用余额230.53元。附言:账户1546包年短信服务费。","t":1734739538228}

0 comments on commit d91049d

Please sign in to comment.