iota9star / fapiao-simple

国家税务总局全国增值税发票查验平台(https://inv-veri.chinatax.gov.cn/) 测试查询
10 stars 4 forks source link

查验后js报错 #5

Closed zyzowen1944 closed 5 years ago

zyzowen1944 commented 5 years ago

说swjgmcft 没有定义,我看子core.js 里27177行的 函数里有对这个变量进行波尔运算,麻烦看下。

iota9star commented 5 years ago

core.js的构成是Envjs+发票网站原始代码复制粘贴进去的,我个人只加了这两个方法 两个方法,之前在我电脑上是没问题的,你检查一下这个报错的地方和网站原始的代码对比一下,看网站是否是发生改变。如果不想仔细看代码,最简单最直接的就是清空core.js,把内容改成envjs+网站js的内容都粘贴进去,然后再加上这两个方法就行了,费点时间,但是肯定能用

zyzowen1944 commented 5 years ago

好的,我今天抽空试下你的方法,谢谢

zyzowen1944 commented 5 years ago

这个问题处理掉了 我在core里面把线上的一段js加上就能拿到 查验的publickey了 var VVV = 'V1.0.07_001'; eval(function(p, a, c, k, e, d) { e = function(c) { return (c < a ? "" : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) } ; if (!''.replace(/^/, String)) { while (c--) d[e(c)] = k[c] || e(c); k = [function(e) { return d[e] } ]; e = function() { return '\w+' } ; c = 1; } ;while (c--) if (k[c]) p = p.replace(new RegExp('\b' + e(c) + '\b','g'), k[c]); return p; }('o 1C=0;u 1n(a){o b=/^1|0\d{11}$|^\d{6}[1-9]\d{2}0$/;o c=/^0{8}[1-9]?\w[1-9]\d$/;o e=b.F(a);o f=c.F(a);p(e==z&&1r(a)&&Z(a)!="J"){q z}s{q r}};u 1r(a){o b;o d=V Y();o e=d.S();o f=e.1M();o g=f.x(2);p(a.L==12){b=a.x(5,7)}s{b=a.x(4,6)}p(b<=1L||b>g){q r}q z};u 1l(a){o b=/^\d{8}$/;o c=/^0{8}$/;o d=/^0{11}-?[1-9]\w\d$/;o e=b.F(a);o f=c.F(a);p(e==z&&f==r){q z}s{q r}};u 1x(a){o b=/^\d{8}$/;o c=/^0{8}$/;o d=/^0{11}-?[1-9]\w\d$/;o e=b.F(a);p(e==z){o g=V Y();o h=g.S();o i=g.1p()+1;o j=g.1o();o k=a.x(0,4);o l=1q(a.x(4,6),10);o m=1q(a.x(6),10);o n=W(0);o t=W(1);p((h!=k&&h-1!=k)||l==0||l>12||m==0||m>1A||a>n||!1z(k,l,m)||(h==k&&i==l&&j==m)){q r}p(h-1==k&&a<=t){q r}q z}s{q r}};u W(i){o a=V Y();o b=0;o c=0;o d=0;o e="";b=a.S()-i;c=a.1p()+1;d=a.1o();e+=b;p(c>=10){e+=c}s{e+="0"+c}p(d>=10){e+=d}s{e+="0"+d}q e}u 1z(a,b,c){p(c>1A){q r}s p(c<1){q r}s{p(b==2){p(c>29){q r}p(((a%4)==0)&&((a%1N)!=0)||((a%1K)==0)){q z}s{p(c>28){q r}}}s p((b==4||b==6||b==9||b==11)&&c>1H){q r}}q z}u Z(a){o b;o c="J";p(a.L==12){b=a.x(7,8);1b(o i=0;i<G.L;i++){p(a==G[i]){c="10";1G}}p(c=="J"){p(a.K(0)==\'0\'&&a.x(10,12)==\'11\'){c="10"}p(a.K(0)==\'0\'&&(a.x(10,12)==\'U\'||a.x(10,12)==\'1O\')){c="U"}p(a.K(0)==\'0\'&&(a.x(10,12)==\'1I\'||a.x(10,12)==\'1J\')){c="11"}p(a.K(0)==\'0\'&&a.x(10,12)==\'12\'){c="14"}}p(c=="J"){p(a.x(10,12)==\'17\'&&a.K(0)==\'0\'){c="15"}p(c=="J"&&b==2&&a.K(0)!=\'0\'){c="T"}}}s p(a.L==10){b=a.x(7,8);p(b==1||b==5){c="13"}s p(b==6||b==3){c="U"}s p(b==7||b==2){c="Q"}}q c};u 1t(a,b){o c=Z(a);p(c=="13"||c=="Q"||c=="T"||c=="15"){q 1j(b)}s{q 1c(b)}};u 1j(a){o b=/(^-?\d{1,11}$)|(^-?\d{1,11}\.\d{1,2}$)/;o c=b.F(a);q c};u 1c(a){o b=/^-?(\d+$)|(\d+\.\d{1,2})$/;o c=b.F(a);q c};u 1u(a){o b=/^\d{6}$/;o e=b.F(a);q e};u 1s(v){o G;1b(o i=0;i<v.L;i++){G=v.1E(i);p((G>1D)||(G==1F)){q r}}q z}u 1B(A,D,B,C,v){p(A==""||D==""||B==""||C==""){q r}s{p(v==""||v=="R"){q r}s{q z}}}u 1P(){$(\'#A\').y("");$(\'#D\').y("");$(\'#B\').y("2f");$(\'#C\').y("");$("#2e").1a("1e","1f/G.1d");$("#2a").1a("1e","1f/G.1d");$("#2b").I("2c(2d):");$("#1k").I("27");$("#1k").P().N("O");$("#1i").I("2g");$("#1i").P().N("O");$("#1g").I("1V");$("#1g").P().N("O");$("#1h").I("1U");$("#1h").P().N("O");$(\'#v\').y("R");$(\'#v\').18(\'16\',\'#19\');$(\'#B\').18(\'16\',\'#19\');$("#1X").I("");1W=1;1R="";1Q="";$("#A").1T()}u X(H){o A=$("#A").y().E();o D=$("#D").y().E();o B=$("#B").y().E();o C=$("#C").y().E();o v=$("#v").y().E();o 1S="";o 1Y="";o M=1;p(B=="24"){B=""}p(!1B(A,D,B,C,v)){q r}p(H=="J"){q r}p(H=="13"||H=="Q"||H=="T"||H=="15"){M=0}o c=/^[0-9]$/;o f=c.F(A);p(f==r){q r}p(1n(A)&&1l(D)&&1x(B)&&((M==0&&1t(A,C))||(M==1&&1u(C)))&&1s(v)){q z}23.26(\'X r\');q r}u 25(){o A=$("#A").y().E();o D=$("#D").y().E();o B=$("#B").y().E();o C=$("#C").y().E();o v=$("#v").y().E();p(A==""||D==""||B==""||C==""||v==""||v=="R"){20(\'1Z!\',\'22\');q r}s{q z}q z}u 21(H){p(X(H)){$(\'#1v\').1y();$(\'#1m\').1w()}s{$(\'#1m\').1y();$(\'#1v\').1w()}}', 62, 141, '||||||||||||||||||||||||var|if|return|false|else||function|yzm||substring|val|true|fpdm|kprq|kjje|fphm|trim|test|code|fplx|text|99|charAt|length|flag|addClass|tip_common|removeClass|02|请输入验证码|getFullYear|03|04|new|ca|avai|Date|alxd||||01|||color||css|999999|attr|for|eb|png|src|images|kprqjy|kjjejy|fphmjy|ea|fpdmjy|ahm|checkfp|adm|getDate|getMonth|parseInt|bc|avym|aje|ajy|uncheckfp|show|acq|hide|cb|31|aept|swjgmcft|65248|charCodeAt|12288|break|30|06|07|400|00|toString|100|05|arw|show_yzm|yzmSj|jqbm|focus|请输入开具金额|请输入开票日期|xsje|yzminfo|fpskm|请先输入各项信息|jAlert|acb|提示|console|YYMMDD|aur|log|请输入发票代码|||yzm_unuse_img|context|开具金额|不含税|yzm_img|YYYYMMDD|请输入发票号码'.split('|'), 0, {})) function getSwjg(fpdm, ckflag) { var flag = ""; eval(function(p, a, c, k, e, d) { e = function(c) { return (c < a ? "" : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) } ; if (!''.replace(/^/, String)) { while (c--) d[e(c)] = k[c] || e(c); k = [function(e) { return d[e] } ]; e = function() { return '\w+' } ; c = 1; } ;while (c--) if (k[c]) p = p.replace(new RegExp('\b' + e(c) + '\b','g'), k[c]); return p; }('24 X=[{\'7\':\'12\',\'8\':\'13\',\'6\':\'0://3.G.4.2.1:5\',\'9\':\'0://3.G.4.2.1:5\'},{\'7\':\'14\',\'8\':\'Y\',\'6\':\'0://3.L.2.1:5\',\'9\':\'0://3.L.2.1:5\'},{\'7\':\'1j\',\'8\':\'1g\',\'6\':\'0://3.U.4.2.1\',\'9\':\'0://3.U.4.2.1\'},{\'7\':\'1k\',\'8\':\'1f\',\'6\':\'0://3.K.4.2.1:5\',\'9\':\'0://3.K.4.2.1:5\'},{\'7\':\'1a\',\'8\':\'18\',\'6\':\'0://3.R.4.2.1:5\',\'9\':\'0://3.R.4.2.1:5\'},{\'7\':\'1e\',\'8\':\'1h\',\'6\':\'0://3.m.4.2.1:5\',\'9\':\'0://3.m.4.2.1:5\'},{\'7\':\'1c\',\'8\':\'1b\',\'6\':\'0://3.q.2.1:5\',\'9\':\'0://3.q.2.1:5\'},{\'7\':\'1d\',\'8\':\'17\',\'6\':\'0://3.j.4.2.1:d\',\'9\':\'0://3.j.4.2.1:d\'},{\'7\':\'19\',\'8\':\'1l\',\'6\':\'0://3.f-n-a.2.1:5\',\'9\':\'0://3.f-n-a.2.1:5\'},{\'7\':\'1n\',\'8\':\'1m\',\'6\':\'0://B.a.A.2.1:z\',\'9\':\'0://B.a.A.2.1:z\'},{\'7\':\'1i\',\'8\':\'W\',\'6\':\'0://3.F.4.2.1:b\',\'9\':\'0://3.F.4.2.1:b\'},{\'7\':\'V\',\'8\':\'10\',\'6\':\'0://3.u.4.2.1:5\',\'9\':\'0://3.u.4.2.1:5\'},{\'7\':\'16\',\'8\':\'Z\',\'6\':\'0://3.v.4.2.1:5\',\'9\':\'0://3.v.4.2.1:5\'},{\'7\':\'11\',\'8\':\'15\',\'6\':\'0://3.w.4.2.1:5\',\'9\':\'0://3.w.4.2 .1:5\'},{\'7\':\'1o\',\'8\':\'1T\',\'6\':\'0://3.x.4.2.1:5\',\'9\':\'0://3.x.4.2.1:5\'},{\'7\':\'1S\',\'8\':\'1U\',\'6\':\'0://3.y.4.2.1\',\'9\':\'0://3.y.4.2.1\'},{\'7\':\'1W\',\'8\':\'1V\',\'6\':\'0://3.s.4.2.1:t\',\'9\':\'0://3.s.4.2.1:t\'},{\'7\':\'1R\',\'8\':\'1N\',\'6\':\'0://3.D.4.2.1:5\',\'9\':\'0://3.D.4.2.1:5\'},{\'7\':\'1M\',\'8\':\'1O\',\'6\':\'0://3.E.4.2.1:5\',\'9\':\'0://3.E.4.2.1:5\'},{\'7\':\'1Q\',\'8\':\'1P\',\'6\':\'0://3.C.4.2.1\',\'9\':\'0://3.C.4.g 23.1\'},{\'7\':\'25\',\'8\':\'27\',\'6\':\'0://3.r-n-a.2.1:5\',\'9\':\'0://3.r-n-a.2.1:5\'},{\'7\':\'26\',\'8\':\'22\',\'6\':\'0://3.h.4.2.1:e\',\'9\':\'0://3.h.4.2.1:e\'},{\'7\':\'1Y\',\'8\':\'1X\',\'6\':\'0://3.i-n-a.2.1:5\',\'9\':\'0://3.i-n-a.2.1:5\'},{\'7\':\'1Z\',\'8\':\'21\',\'6\':\'0://3.c.4.2.1:5\',\'9\':\'0://3.c.4.2.1:5\'},{\'7\':\'20\',\'8\':\'1L\',\'6\':\'0://3.o.4.2.1:p\',\'9\':\'0://3.o.4.2.1:p\'},{\'7\':\'1w\',\'8\':\'1v\',\'6\':\'0://3.k.4.2.1:5\',\'9\':\'0://3.k.4.2.1:5\'},{\'7\':\'1x\',\'8\':\'1z\',\'6\':\'0://3.l.4.2.1:b\',\'9\':\'0://3.l.4.2.1:b\'},{\'7\':\'1y\',\'8\':\'1u\',\'6\':\'0://3.Q.4.2.1:5\',\'9\':\'0://3.Q.4.2.1:5\'},{\'7\':\'1q\',\'8\':\'1p\',\'6\':\'0://3.T-n-a.2.1:b\',\'9\':\'0://3.T-n-a.2.1:b\'},{\'7\':\'1r\',\'8\':\'1t\',\'6\':\'0://3.J.2.1:5\',\'9\':\'0://3.J.2.1:5\'},{\'7\':\'1s\',\'8\':\'1H\',\'6\':\'0://3.H.2.1:O\',\'9\':\'0://3.H.2.1:O\'},{\'7\':\'1G\',\'8\':\'1I\',\'6\':\'0://3.N.4.2.1:5\',\'9\':\'0://3.N.4.2.1:5\'},{\'7\':\'1K\',\'8\':\'1J\',\'6\':\'0://3.M.4.2.1:5\',\'9\':\'0://3.M.4.2.1:5\'},{\'7\':\'1F\',\'8\':\'1B\',\'6\':\'0://3.P.4.2.1:5\',\'9\':\'0://3.P.4.2.1:5\'},{\'7\':\'1A\',\'8\':\'1C\',\'6\':\'0://3.I.4.2.1:5\',\'9\':\'0://3.I.4.2.1:5\'},{\'7\':\'1E\',\'8\':\'1D\',\'6\':\'0://3.S-n-a.2.1:5\',\'9\':\'0://3.S-n-a.2.1:5\'}];', 62, 132, 'https|cn|gov|fpcy|chinatax|443|Ip|code|sfmc|address|tax|80|shenzhen|4432|8083|hl||hunan|gd|jilin|hainan|chongqing|liaoning||guangxi|8200|dlntax|hb|jiangxi|82|zhejiang|ningbo|anhui|fujian|xiamen|1001|sh|fpcyweb|henan|shandong|qingdao|jiangsu|beijing|xztax|ningxia|yngs|shanxi|tjsat|gansu|shaanxi|81|qinghai|sichuan|neimenggu|xj|gz|hebei|3300|江苏|citys|天津|宁波|浙江|3400|1100|北京|1200|安徽|3302|吉林|内蒙古|2300|1500|大连|2102|2200|2100|山西|河北|辽宁|3200|1300|1400|黑龙江|上海|3100|3500|贵州|5200|5300|5400|云南|四川|海南|4600|5000|5100|重庆|6400|青海|宁夏|新疆|6500|6300|6100|西藏|陕西|甘肃|6200|广西|3702|山东|青岛|河南|4100|3700|3502|福建|厦门|江西|3600|广东|4400|4403|4500|深圳|湖南|ov|var|4200|4300|湖北'.split('|'), 0, {})) var dqdm = null; var swjginfo = new Array(); if (fpdm.length == 12) { dqdm = fpdm.substring(1, 5) } else { dqdm = fpdm.substring(0, 4) } if (dqdm != "2102" && dqdm != "3302" && dqdm != "3502" && dqdm != "3702" && dqdm != "4403") { dqdm = dqdm.substring(0, 2) + "00" } for (var i = 0; i < citys.length; i++) { if (dqdm == citys[i].code) { swjginfo[0] = citys[i].sfmc; if (flag == 'debug') {} else { swjginfo[1] = citys[i].Ip + "/WebQuery"; swjginfo[2] = dqdm } break } } return swjginfo; }

但是,现在新问题出来,debug到最终查验的每个具体的地区的接口,比如上海的,最后返回007,验证码失效,有点没头绪了。

iota9star commented 5 years ago

你把okhttp换成httpclient的方式试试,这个是因为验证码时间不对的原因,你看下验证码返回的时间应该是不正确的,他默认是五分钟失效,返回的时间和你提交的实际时间是对不上的