Skip to content

Commit

Permalink
✨ (短信规则): 添加广东华兴银行收入短信解析规则 #638
Browse files Browse the repository at this point in the history
新增对广东华兴银行收入短信的解析规则,支持识别转账存入、金额、余额及摘要信息。同时添加了相应的测试用例和测试数据文件,确保解析功能的正确性。
  • Loading branch information
AnkioTomas committed Dec 27, 2024
1 parent ee85b4c commit 349f1f3
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/rule/com.android.phone/app/短信广东华兴银行/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,27 @@ const rules = [
obj.accountNameFrom = `${senderName}(${number})`;
return obj;
}
]
], // 【广东华兴银行】您尾号8665账户12月21日00:28转账存入人民币16.99元,余额36168.11元,摘要:利息结息入账。 本机构吸收的本外币存款依照《存款保险条例》受到保护。登录手机银行了解详情 u.ghbank.com.cn/1KRM
[
//您尾号8665账户12月21日00:28转账存入人民币16.99元,余额36168.11元,摘要:利息结息入账。
/您尾号(\d{4})账户(\d+月\d+日\d+:\d+)(.*?)人民币(.*?)元,余额(.*?)元,摘要:(.*?)。/,
match => {
let [, number, date, type, money, , item] = match;

let obj = new RuleObject();

let { matchType, typeName } = isPaymentType(type);

obj.money = toFloat(money);
obj.channel = `${senderName}[${typeName}]`;
obj.shopItem = type;
obj.shopName = item;
obj.time = formatDate(date, 'M月D日h:i');
obj.type = matchType;
obj.accountNameFrom = `${senderName}(${number})`;
return obj;
}
]
];

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,20 @@ test('广东华兴银行支出', () =>
'channel': '广东华兴银行[支出]'
}
]));

test('广东华兴银行收入', () =>
testAnkio('广东华兴银行收入', [
{
'type': 'Income',
'money': 16.99,
'fee': 0,
'shopName': '利息结息入账',
'shopItem': '转账存入',
'accountNameFrom': '广东华兴银行(8665)',
'accountNameTo': '',
'currency': 'CNY',
'time': formatDate('12月21日00:28', 'M月D日h:i'),
'channel': '广东华兴银行[收入]'
}
]));

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"sender": "广东华兴银行",
"body": "【广东华兴银行】您尾号8665账户12月21日00:28转账存入人民币16.99元,余额36168.11元,摘要:利息结息入账。 本机构吸收的本外币存款依照《存款保险条例》受到保护。登录手机银行了解详情 u.ghbank.com.cn/1KRM",
"t": 1734774025192
}

0 comments on commit 349f1f3

Please sign in to comment.