diff --git a/app/src/main/java/com/weihuagu/receiptnotice/pushclassification/pmentay/AlipayPmentayNotificationHandle.java b/app/src/main/java/com/weihuagu/receiptnotice/pushclassification/pmentay/AlipayPmentayNotificationHandle.java index 4901018..e860136 100644 --- a/app/src/main/java/com/weihuagu/receiptnotice/pushclassification/pmentay/AlipayPmentayNotificationHandle.java +++ b/app/src/main/java/com/weihuagu/receiptnotice/pushclassification/pmentay/AlipayPmentayNotificationHandle.java @@ -30,7 +30,27 @@ public void handleNotification(){ if(title.contains("支付宝") | title.contains("收钱码") | title.contains("收款通知")){ //不可将转账判断延后放,以防止通过昵称虚构金额 if(content.contains("向你转了1笔钱")){ - Map postmap=new HashMap(); + transfercodePush(); + return ; + } + + if(content.contains("成功收款") | content.contains("向你付款")){ + collectioncodePush(true); + return ; + } + } + if(isInfoHideInTitle()){ + collectioncodePush(false); + return ; + } + + + + + } + + private void transfercodePush(){ + Map postmap=new HashMap(); postmap.put("type","alipay-transfer"); postmap.put("time",notitime); postmap.put("title","转账"); @@ -50,25 +70,33 @@ public void handleNotification(){ postpush.doPost(postmap); return ; - } - - if(content.contains("成功收款") | content.contains("向你付款")){ - Map postmap=new HashMap(); - postmap.put("type","alipay"); - postmap.put("time",notitime); - postmap.put("title","支付宝支付"); - postmap.put("money",extractMoney(content)); - postmap.put("content",content); - - postpush.doPost(postmap); - return ; - } - } - - - - } - + + } + + private void collectioncodePush(boolen isinfoincontent){ + Map postmap=new HashMap(); + postmap.put("type","alipay"); + postmap.put("time",notitime); + postmap.put("title","支付宝支付"); + if(isinfoincontent){ + postmap.put("money",extractMoney(content)); + postmap.put("content",content); + }else + { + postmap.put("money",extractMoney(title)); + postmap.put("content",title); + } + + postpush.doPost(postmap); + return ; + } + + private boolen isInfoHideInTitle(){ + if(title.contains("成功收款")&&content.contains("查看余额")) + return true; + return false; + + } private String whoTransferred(String content){ Pattern pattern = Pattern.compile("(.*)(已成功向你转了)"); Matcher matcher = pattern.matcher(content);