From 5cb213220f8927f0052fe98a52f1a07106267ccb Mon Sep 17 00:00:00 2001 From: ankio Date: Wed, 18 Dec 2024 11:11:51 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20(=E6=94=AF=E4=BB=98=E5=AE=9D?= =?UTF-8?q?=E7=BD=91=E5=95=86=E9=93=B6=E8=A1=8C):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BD=99=E9=A2=9D=E8=87=AA=E5=8A=A8=E8=BD=AC=E5=85=A5=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=20#465?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增处理支付宝网商银行余额自动转入的逻辑,包括测试用例和相关代码实现。 --- .../main.js" | 34 ++++++++++++++----- .../main.test.js" | 17 ++++++++++ ...2\345\212\250\350\275\254\345\205\245.txt" | 10 ++++++ 3 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 "src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\347\275\221\345\225\206\351\223\266\350\241\214/tests/\346\224\257\344\273\230\345\256\235\347\275\221\345\225\206\351\223\266\350\241\214\344\275\231\351\242\235\350\207\252\345\212\250\350\275\254\345\205\245.txt" diff --git "a/src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\347\275\221\345\225\206\351\223\266\350\241\214/main.js" "b/src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\347\275\221\345\225\206\351\223\266\350\241\214/main.js" index c6a1881..3775e62 100644 --- "a/src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\347\275\221\345\225\206\351\223\266\350\241\214/main.js" +++ "b/src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\347\275\221\345\225\206\351\223\266\350\241\214/main.js" @@ -16,6 +16,23 @@ function transfer(pl,t){ return obj; } +function transfer2(pl,t){ + let obj = new RuleObject(BillType.Transfer); + + obj.channel = `支付宝[网商银行-余额自动转入]`; + + let extras = JSON.parse(pl.extraInfo); + obj.money = toFloat(extras.assistMsg1); + obj.time = t; + + obj.shopItem = extras.content; + obj.shopName = "网商银行"; + obj.accountNameFrom = `支付宝余额`; + obj.accountNameTo = `网商银行`; + return obj; +} + + function expand(pl,t){ let obj = new RuleObject(BillType.Expend); obj.money = toFloat(pl.content); @@ -44,14 +61,15 @@ export function get(data) { if (pl.content.indexOf('做任务') !== -1){ return null; } - - if (pl.templateName.indexOf("交易成功提醒")===-1){ - if (pl.homePageTitle.indexOf("转账") !== -1){ - return transfer(pl, t); - }else{ - return expand(pl,t); - } + if (pl.homePageTitle.indexOf("余额已自动转入余利宝") !== -1){ + return transfer2(pl, t); + } + if (pl.homePageTitle.indexOf("转账-") !== -1){ + return transfer(pl, t); + } + if (pl.homePageTitle.indexOf("支付宝支付") !==-1){ + return expand(pl,t); } - return expand(pl,t); + return null; } diff --git "a/src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\347\275\221\345\225\206\351\223\266\350\241\214/main.test.js" "b/src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\347\275\221\345\225\206\351\223\266\350\241\214/main.test.js" index 09a3312..10b268e 100644 --- "a/src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\347\275\221\345\225\206\351\223\266\350\241\214/main.test.js" +++ "b/src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\347\275\221\345\225\206\351\223\266\350\241\214/main.test.js" @@ -21,6 +21,23 @@ test('支付宝网商银行转出', () => }, ])); + +test('支付宝网商银行余额自动转入', () => + testAnkio('支付宝网商银行余额自动转入', [ + { + "type": "Transfer", + "money": 1706.42, + "fee": 0, + "shopName": '网商银行', + "shopItem": '余额已自动转入', + "accountNameFrom": '支付宝余额', + "accountNameTo": '网商银行', + "currency": 'CNY', + "time": 1730038418000, + "channel": '支付宝[网商银行-余额自动转入]', + }, + + ])); test('支付宝网商银行支出', () => testAnkio('支付宝网商银行支出', [ { diff --git "a/src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\347\275\221\345\225\206\351\223\266\350\241\214/tests/\346\224\257\344\273\230\345\256\235\347\275\221\345\225\206\351\223\266\350\241\214\344\275\231\351\242\235\350\207\252\345\212\250\350\275\254\345\205\245.txt" "b/src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\347\275\221\345\225\206\351\223\266\350\241\214/tests/\346\224\257\344\273\230\345\256\235\347\275\221\345\225\206\351\223\266\350\241\214\344\275\231\351\242\235\350\207\252\345\212\250\350\275\254\345\205\245.txt" new file mode 100644 index 0000000..a80f857 --- /dev/null +++ "b/src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\347\275\221\345\225\206\351\223\266\350\241\214/tests/\346\224\257\344\273\230\345\256\235\347\275\221\345\225\206\351\223\266\350\241\214\344\275\231\351\242\235\350\207\252\345\212\250\350\275\254\345\205\245.txt" @@ -0,0 +1,10 @@ +[ +{ +"mk": 241067221338200001, +"st": 1, +"isSc": 0, +"appId": "", +"mct": 1730038418000, +"pl": "{\"templateType\":\"S\",\"commandType\":\"UPDATE\",\"expireLink\":\"https://render.alipay.com/p/f/fd-jblxfp45/pages/home/index.html\",\"withPushNfc\":\"N\",\"msgType\":\"NOTICE\",\"appInfo\":\"{\\\"appName\\\":\\\"网商银行\\\",\\\"appId\\\":\\\"2015121400973550\\\",\\\"linkUrl\\\":\\\"alipays://platformapi/startapp?appId=20000042&publicBizType=LIFE_APP&sourceId=notifications&publicId=2015121400973550\\\",\\\"msgListConfig\\\":\\\"1\\\",\\\"logoUrl\\\":\\\"http://mdn.alipayobjects.com/afts/img/o4RRXj6ORd2_HuMFHv91SgAAACMAAQQD/original?bz=mwalletmng\\\"}\",\"icon\":\"http://mdn.alipayobjects.com/afts/img/o4RRXj6ORd2_HuMFHv91SgAAACMAAQQD/original?bz=mwalletmng\",\"link\":\"alipays://platformapi/startapp?appId=66666708&url=https%3A%2F%2Frender.alipay.com%2Fp%2Fh5%2Falipay-yulibao%2Fwww%2Findex.html%3FchInfo%3Dfeed\",\"msgId\":\"d8202c466299c0e97422532ab68148f700567\",\"templateCode\":\"BKPRM_ylbzdzr1211\",\"templateId\":\"WALLET-FWC@remindDefaultText\",\"title\":\"网商银行\",\"content\":\"余额已自动转入\",\"linkName\":\"查看详情\",\"bizName\":\"网商银行\",\"appId\":\"2015121400973550\",\"msgCategory\":\"service\",\"subscribeMsg\":false,\"ih\":\"{\\\"extInfo\\\":{},\\\"iid\\\":\\\"105\\\",\\\"ioty\\\":\\\"aor\\\",\\\"itemBasicInfo\\\":{\\\"dn\\\":\\\"服务提醒\\\",\\\"ic\\\":\\\"https://gw.alipayobjects.com/zos/bmw-prod/b96c31e0-64ba-4cbb-9a64-73ff17d701fd.webp\\\",\\\"lk\\\":\\\"alipays://platformapi/startapp?appId=20000235&source=friendTab\\\"},\\\"itemUserRelation\\\":{\\\"ilf\\\":\\\"N\\\",\\\"uc\\\":{\\\"top\\\":\\\"0\\\",\\\"ic\\\":\\\"0\\\"},\\\"version\\\":0},\\\"ity\\\":\\\"105\\\",\\\"moty\\\":\\\"u\\\",\\\"msgInfo\\\":{\\\"bm\\\":\\\"余额已自动转入余利宝\\\",\\\"cmid\\\":\\\"d8202c466299c0e97422532ab68148f700567\\\",\\\"lmt\\\":1730038418071,\\\"msrid\\\":\\\"BKPRM_ylbzdzr1211\\\",\\\"ncs\\\":\\\"N\\\",\\\"rps\\\":\\\"num\\\",\\\"sam\\\":\\\"Y\\\",\\\"sn\\\":\\\"网商银行\\\",\\\"urn\\\":1}}\",\"bizMonitor\":\"{\\\"isFollow\\\":false,\\\"serviceCode\\\":\\\"BKPRM_ylbzdzr1211\\\",\\\"bizName\\\":\\\"网商银行\\\",\\\"createTime\\\":1730038418083,\\\"targetDataId\\\":\\\"MG294029d928c94cacb49b921667a1ca92\\\",\\\"appId\\\":\\\"2015121400973550\\\",\\\"messageId\\\":\\\"d8202c466299c0e97422532ab68148f700567\\\",\\\"messageTitle\\\":\\\"网商银行\\\",\\\"templateId\\\":\\\"WALLET-FWC@remindDefaultText\\\"}\",\"subscribeConfig\":\"1\",\"gmtCreate\":1730038418071,\"gmtValid\":2045571218071,\"operate\":\"SEND\",\"templateName\":\"余利宝自动转入消息-新\",\"homePageTitle\":\"余额已自动转入余利宝\",\"attributes\":\"0000000000000001\",\"extraInfo\":\"{\\\"hiddenSumFlag\\\":\\\"N\\\",\\\"expireLink\\\":\\\"https://render.alipay.com/p/f/fd-jblxfp45/pages/home/index.html\\\",\\\"icon\\\":\\\"http://mdn.alipayobjects.com/afts/img/o4RRXj6ORd2_HuMFHv91SgAAACMAAQQD/original?bz=mwalletmng\\\",\\\"link\\\":\\\"alipays://platformapi/startapp?appId=66666708&url=https%3A%2F%2Frender.alipay.com%2Fp%2Fh5%2Falipay-yulibao%2Fwww%2Findex.html%3FchInfo%3Dfeed\\\",\\\"assistName2\\\":\\\"转入时间\\\",\\\"assistName3\\\":\\\"温馨提醒\\\",\\\"assistName1\\\":\\\"转入金额\\\",\\\"subscribeConfig\\\":\\\"1\\\",\\\"title\\\":\\\"网商银行\\\",\\\"templateId\\\":\\\"WALLET-FWC@remindDefaultText\\\",\\\"content\\\":\\\"余额已自动转入\\\",\\\"linkName\\\":\\\"查看详情\\\",\\\"assistMsg3\\\":\\\"省时省心,收益天天算\\\",\\\"assistMsg2\\\":\\\"10-27 22:13\\\",\\\"assistMsg1\\\":\\\"+1,706.42\\\",\\\"gmtValid\\\":2045571218071,\\\"sceneExt\\\":{\\\"sceneTemplateId\\\":\\\"WALLET-FWC@remindDefaultText\\\",\\\"sceneUrl\\\":\\\"alipays://platformapi/startapp?appId=20000042&publicBizType=LIFE_APP&sourceId=notifications&publicId=2015121400973550\\\",\\\"sceneType\\\":\\\"lifePublic\\\",\\\"forwardLifePublicMsg\\\":\\\"N\\\",\\\"sceneName\\\":\\\"网商银行\\\",\\\"sceneId\\\":\\\"2015121400973550\\\",\\\"sceneIcon\\\":\\\"http://mdn.alipayobjects.com/afts/img/o4RRXj6ORd2_HuMFHv91SgAAACMAAQQD/original?bz=mwalletmng\\\",\\\"sceneExtInfo\\\":\\\"\\\",\\\"sceneTitle\\\":\\\"进入生活号\\\"},\\\"homePageTitle\\\":\\\"余额已自动转入余利宝\\\",\\\"imageUrl\\\":\\\"\\\",\\\"buttonLink\\\":\\\"alipays://platformapi/startapp?appId=66666708&url=https%3A%2F%2Frender.alipay.com%2Fp%2Fh5%2Falipay-yulibao%2Fwww%2Findex.html%3FchInfo%3Dfeed\\\"}\"}" +} +]