diff --git a/README.md b/README.md index 09217db..3fe99a4 100644 --- a/README.md +++ b/README.md @@ -40,11 +40,16 @@ V免签 是基于SpringBoot 2.1.1 实现的一套免签支付程序,主要包 + 本系统原理为监控收款后手机的通知栏推送消息,所以请保持微信/支付宝/V免签监控端后台正常运行,且添加到内存清理白名单! ## 更新记录 - - + v1.0(2019.01.31) - + 初版发布 + + v1.2(2019.02.25) + + 修复收款金额为整数时校验错误的问题 + + 再次修复部分用户无法上传通用收款码问题 + + v1.1(2019.02.10) + 修复部分用户无法上传通用收款码问题 + + + v1.0(2019.01.31) + + 初版发布 + ## 版权信息 diff --git a/src/main/java/com/vone/mq/controller/WebController.java b/src/main/java/com/vone/mq/controller/WebController.java index 2ff7c64..38abc91 100644 --- a/src/main/java/com/vone/mq/controller/WebController.java +++ b/src/main/java/com/vone/mq/controller/WebController.java @@ -117,7 +117,7 @@ public CommonRes deQrcode2(@RequestParam("file") MultipartFile file) { * @return */ @RequestMapping("/createOrder") - public String createOrder(String payId, String param, Integer type, Double price, String notifyUrl, String returnUrl, String sign, Integer isHtml) { + public String createOrder(String payId, String param, Integer type, String price, String notifyUrl, String returnUrl, String sign, Integer isHtml) { if (payId == null || payId.equals("")) { return new Gson().toJson(ResUtil.error("请传入商户订单号")); } @@ -127,12 +127,23 @@ public String createOrder(String payId, String param, Integer type, Double price if (type != 1 && type != 2) { return new Gson().toJson(ResUtil.error("支付方式错误=>1|微信 2|支付宝")); } - if (price == null) { + + + Double priceD; + try { + priceD = Double.valueOf(price); + } catch (Exception e){ return new Gson().toJson(ResUtil.error("请传入订单金额")); } - if (price < 0) { + + if (priceD == null) { + return new Gson().toJson(ResUtil.error("请传入订单金额")); + } + if (priceD < 0) { return new Gson().toJson(ResUtil.error("订单金额必须大于0")); } + + if (sign == null || sign.equals("")) { return new Gson().toJson(ResUtil.error("请传入签名")); } @@ -173,7 +184,7 @@ public CommonRes appHeart(String t, String sign) { } @RequestMapping("/appPush") - public CommonRes appPush(Integer type, Double price, String t, String sign) { + public CommonRes appPush(Integer type, String price, String t, String sign) { return webService.appPush(type, price, t, sign); } diff --git a/src/main/java/com/vone/mq/service/WebService.java b/src/main/java/com/vone/mq/service/WebService.java index dfea5eb..185aa03 100644 --- a/src/main/java/com/vone/mq/service/WebService.java +++ b/src/main/java/com/vone/mq/service/WebService.java @@ -32,13 +32,16 @@ public class WebService { @Autowired private PayQrcodeDao payQrcodeDao; - public CommonRes createOrder(String payId, String param, Integer type, Double price, String notifyUrl, String returnUrl, String sign){ + public CommonRes createOrder(String payId, String param, Integer type, String price, String notifyUrl, String returnUrl, String sign){ String key = settingDao.findById("key").get().getVvalue(); String jsSign = md5(payId+param+type+price+key); if (!sign.equals(jsSign)){ return ResUtil.error("签名校验不通过"); } + Double priceD = Double.valueOf(price); + + Date currentTime = new Date(); SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); @@ -47,7 +50,7 @@ public CommonRes createOrder(String payId, String param, Integer type, Double pr int payQf = Integer.parseInt(settingDao.findById("payQf").get().getVvalue()); //实际支付价格 - double reallyPrice = price; + double reallyPrice = priceD; int row = 0; while (row == 0){ @@ -106,7 +109,7 @@ public CommonRes createOrder(String payId, String param, Integer type, Double pr payOrder.setCloseDate(0); payOrder.setParam(param); payOrder.setType(type); - payOrder.setPrice(price); + payOrder.setPrice(priceD); payOrder.setReallyPrice(reallyPrice); payOrder.setNotifyUrl(notifyUrl); payOrder.setReturnUrl(returnUrl); @@ -119,7 +122,7 @@ public CommonRes createOrder(String payId, String param, Integer type, Double pr String timeOut = settingDao.findById("close").get().getVvalue(); - CreateOrderRes createOrderRes = new CreateOrderRes(payId,orderId,type,price,reallyPrice,payUrl,isAuto,0,Integer.valueOf(timeOut),payOrder.getCreateDate()); + CreateOrderRes createOrderRes = new CreateOrderRes(payId,orderId,type,priceD,reallyPrice,payUrl,isAuto,0,Integer.valueOf(timeOut),payOrder.getCreateDate()); return ResUtil.success(createOrderRes); } @@ -172,7 +175,7 @@ public CommonRes appHeart(String t,String sign){ return ResUtil.success(); } - public CommonRes appPush(Integer type,Double price,String t,String sign){ + public CommonRes appPush(Integer type,String price,String t,String sign){ String key = settingDao.findById("key").get().getVvalue(); long cz = Long.valueOf(t)-new Date().getTime(); @@ -196,7 +199,7 @@ public CommonRes appPush(Integer type,Double price,String t,String sign){ return ResUtil.error("重复推送"); } - PayOrder payOrder = payOrderDao.findByReallyPriceAndStateAndType(price,0,type); + PayOrder payOrder = payOrderDao.findByReallyPriceAndStateAndType(Double.valueOf(price),0,type); if (payOrder==null){ @@ -208,8 +211,8 @@ public CommonRes appPush(Integer type,Double price,String t,String sign){ payOrder.setCloseDate(new Date().getTime()); payOrder.setParam("无订单转账"); payOrder.setType(type); - payOrder.setPrice(price); - payOrder.setReallyPrice(price); + payOrder.setPrice(Double.valueOf(price)); + payOrder.setReallyPrice(Double.valueOf(price)); payOrder.setState(1); payOrder.setPayUrl("无订单转账"); payOrderDao.save(payOrder); diff --git a/src/main/webapp/admin/setting.html b/src/main/webapp/admin/setting.html index 0b3a2a1..57bf5b7 100644 --- a/src/main/webapp/admin/setting.html +++ b/src/main/webapp/admin/setting.html @@ -122,7 +122,7 @@ if (res.code == -1) { return layer.msg('上传失败'); } - if (res.data=="" || res.data.substr(0,6)!="wxp://"){ + if (res.data==""){ return layer.msg('请上传微信无金额收款二维码'); } $('#wximg').attr('src', "enQrcode?url="+res.data); @@ -148,7 +148,7 @@ if (res.code == -1) { return layer.msg('上传失败'); } - if (res.data=="" || res.data.substr(0,22).toUpperCase()!="HTTPS://QR.ALIPAY.COM/"){ + if (res.data=="" ){ return layer.msg('请上传支付宝无金额收款二维码'); } $('#zfbimg').attr('src', "enQrcode?url="+res.data);