diff --git a/README.md b/README.md index ef2615f..a95af20 100644 --- a/README.md +++ b/README.md @@ -96,8 +96,13 @@ V免签为完全开源项目,开源项目意味着作者没有任何收入来 + 微信店员收款推送通知 ## 更新记录 + + + v1.6.1(2019.04.26) + + 再次优化二维码识别,使用js解析二维码,如果失败,则使用PHP解析 + + + v1.6(2019.04.25) - + 优化二维码识别,使用js解析二维码,解决部分二维码识别返回false问题 + + 优化二维码识别,使用js解析二维码,解决部分二维码识别返回false问题 + v1.5(2019.04.24) + 同步最新版APP diff --git a/public/admin/addwxqrcode.html b/public/admin/addwxqrcode.html index b8ab612..3bb28ef 100644 --- a/public/admin/addwxqrcode.html +++ b/public/admin/addwxqrcode.html @@ -93,10 +93,24 @@ qrcode.decode(getObjectURL(file),result); qrcode.callback = function(imgMsg,img64) { - imgs.push({"index":imgs.length,"money":"","b64":img64,"url":imgMsg}); - mytable.reload({ - data: imgs - }); + if (imgMsg==""){ + $.post("qr-code/test.php","base64="+encodeURIComponent(img64.split(",")[1]),function (data) { + console.log(data) + if (!data.data) { + data = JSON.parse(data); + } + + imgs.push({"index":imgs.length,"money":"","b64":img64,"url":data.data}); + mytable.reload({ + data: imgs + }); + }); + } else{ + imgs.push({"index":imgs.length,"money":"","b64":img64,"url":imgMsg}); + mytable.reload({ + data: imgs + }); + } } }); diff --git a/public/admin/addzfbqrcode.html b/public/admin/addzfbqrcode.html index efac2f1..d50c189 100644 --- a/public/admin/addzfbqrcode.html +++ b/public/admin/addzfbqrcode.html @@ -85,11 +85,26 @@ */ qrcode.decode(getObjectURL(file),result); qrcode.callback = function(imgMsg,img64) { + if (imgMsg==""){ + $.post("qr-code/test.php","base64="+encodeURIComponent(img64.split(",")[1]),function (data) { + console.log(data) + if (!data.data) { + data = JSON.parse(data); + } + + imgs.push({"index":imgs.length,"money":"","b64":img64,"url":data.data}); + mytable.reload({ + data: imgs + }); + }); + } else{ + imgs.push({"index":imgs.length,"money":"","b64":img64,"url":imgMsg}); + mytable.reload({ + data: imgs + }); + } + - imgs.push({"index":imgs.length,"money":"","b64":img64,"url":imgMsg}); - mytable.reload({ - data: imgs - }); } }); diff --git a/public/admin/setting.html b/public/admin/setting.html index 55f3365..3c6bb01 100644 --- a/public/admin/setting.html +++ b/public/admin/setting.html @@ -121,7 +121,29 @@ qrcode.decode(getObjectURL(file)); qrcode.callback = function(imgMsg) { console.log(imgMsg) - $('#wximg').attr('src', "enQrcode?url="+imgMsg); + if(imgMsg!=""){ + $('#wximg').attr('src', "enQrcode?url="+imgMsg); + }else{ + layer.msg('处理中', { + icon: 16 + ,shade: 0.01 + ,time:0 + }); + + $.post("qr-code/test.php","base64="+encodeURIComponent(result.split(",")[1]),function (data) { + console.log(data) + if (!data.data) { + data = JSON.parse(data); + } + if (data.code==1){ + $('#wximg').attr('src', "enQrcode?url="+data.data); + layer.msg('处理成功'); + } else{ + return layer.msg('处理失败'); + } + + }); + } } }); @@ -166,7 +188,28 @@ qrcode.decode(getObjectURL(file)); qrcode.callback = function(imgMsg) { console.log(imgMsg) - $('#zfbimg').attr('src', "enQrcode?url="+imgMsg); + if(imgMsg!=""){ + $('#zfbimg').attr('src', "enQrcode?url="+imgMsg); + }else{ + layer.msg('处理中', { + icon: 16 + ,shade: 0.01 + ,time:0 + }); + $.post("qr-code/test.php","base64="+encodeURIComponent(result.split(",")[1]),function (data) { + console.log(data) + if (!data.data) { + data = JSON.parse(data); + } + if (data.code==1){ + $('#zfbimg').attr('src', "enQrcode?url="+data.data); + layer.msg('处理成功'); + } else{ + return layer.msg('处理失败'); + } + + }); + } } }); diff --git a/public/js/llqrcode.js b/public/js/llqrcode.js index d0305dc..3231567 100644 --- a/public/js/llqrcode.js +++ b/public/js/llqrcode.js @@ -1466,7 +1466,7 @@ qrcode.decode = function (d,b64) { try { qrcode.imagedata = h.getImageData(0, 0, i.width, i.height) } catch (m) { - qrcode.result = "Cross domain image reading not supported in your browser! Save it to your computer then drag and drop the file!"; + qrcode.result = ""; if (qrcode.callback != null) { qrcode.callback(qrcode.result,b64) } @@ -1476,7 +1476,7 @@ qrcode.decode = function (d,b64) { qrcode.result = qrcode.process(h) } catch (m) { console.log(m); - qrcode.result = "error decoding QR Code" + qrcode.result = "" } if (qrcode.callback != null) { qrcode.callback(qrcode.result,b64) @@ -1484,7 +1484,7 @@ qrcode.decode = function (d,b64) { }; c.onerror = function () { if (qrcode.callback != null) { - qrcode.callback("Failed to load the image") + qrcode.callback("") } }; c.src = d