This commit is contained in:
cheney
2023-01-10 10:20:52 +08:00
parent 852c240113
commit 8fd83d24b6
16 changed files with 12168 additions and 56 deletions
+78 -21
View File
@@ -119,10 +119,10 @@ class ActiveEpc {
__check(v, re, msg, reject) {
if (!re.test(v)) {
reject && reject({
return {
msg,
code: "C0"
})
}
}
}
@@ -137,9 +137,23 @@ class ActiveEpc {
})
}
_this.__check(uid, /\d{1,2}/g, "用户编号填写错误!", reject);
_this.__check(utype, /\d{1}/g, "用户类型填写错误!", reject);
_this.__check(pwd, /\d{6}/g, "密码填写错误!", reject);
var e = _this.__check(uid, /\d{1,2}/g, "用户编号填写错误!")
if ( e ) {
reject && reject(e);
return
}
e = _this.__check(utype, /\d{1}/g, "用户类型填写错误!");
if ( e ) {
reject && reject(e);
return
}
e = _this.__check(pwd, /\d{6}/g, "密码填写错误!");
if ( e ) {
reject && reject(e);
return
}
_this.__send("login", {
uid, utype, pwd
@@ -199,7 +213,11 @@ class ActiveEpc {
var _this = this;
return new Promise(function (resolve, reject) {
_this.__check(minutes, /\d{1,2}/g, "时间填写错误!", reject);
var e = _this.__check(minutes, /\d{1,2}/g, "时间填写错误!");
if ( e ) {
reject && reject(e);
return
}
var v = parseInt(minutes, 10);
if( v > 20 || v < 2 ) {
@@ -239,9 +257,28 @@ class ActiveEpc {
})
}
_this.__check(uid, /\d{1,2}/g, "用户编号填写错误!", reject);
_this.__check(utype, /\d{1}/g, "用户类型填写错误!", reject);
_this.__check(pwd, /\d{6}/g, "密码填写错误!", reject);
var e = _this.__check(uid, /\d{1,2}/g, "用户编号填写错误!");
if ( e ) {
reject && reject(e);
return
}
e = _this.__check(utype, /\d{1}/g, "用户类型填写错误!");
if ( e ) {
reject && reject(e);
return
}
e = _this.__check(pwd, /\d{6}/g, "密码填写错误!");
if ( e ) {
reject && reject(e);
return
}
// 弱口令
e = _this.__check(pwd, /^(?:(\d)(?!((?<=9)8|(?<=8)7|(?<=7)6|(?<=6)5|(?<=5)4|(?<=4)3|(?<=3)2|(?<=2)1|(?<=1)0){5})(?!\1{5})(?!((?<=0)1|(?<=1)2|(?<=2)3|(?<=3)4|(?<=4)5|(?<=5)6|(?<=6)7|(?<=7)8|(?<=8)9){5})){6}$/g, "弱口令!");
if ( e ) {
reject && reject(e);
return
}
_this.__send("modifyPassword", {
uid, utype, pwd
@@ -269,19 +306,39 @@ class ActiveEpc {
_this.__check(accu, /\d{1,32}/g, "收方账户填写错误!", reject);
_this.__check(ticketType, /\d{1}/g, "票据类型填写错误!", reject);
_this.__check(ticketNo, /\d{1,8}/g, "票据编号填写错误!", reject);
_this.__check(date, /^(?:(?:1[6-9]|[2-9][0-9])[0-9]{2}([-/.]?)(?:(?:0?[1-9]|1[0-2])\1(?:0?[1-9]|1[0-9]|2[0-8])|(?:0?[13-9]|1[0-2])\1(?:29|30)|(?:0?[13578]|1[02])\1(?:31))|(?:(?:1[6-9]|[2-9][0-9])(?:0[48]|[2468][048]|[13579][26])|(?:16|[2468][048]|[3579][26])00)([-/.]?)0?2\2(?:29))$/g, "时间填写错误!", reject);
_this.__check(banlance, /\d{1,16}/g, "金额填写错误!", reject);
if ( '4' == ticketType || '5' == ticketType ) {
if ( undefined === accr || "" === accr ) {
reject({
code: "C0",
msg: "票据类型为汇兑和其他时,收方账号必填。"
})
}
var e = _this.__check(accu, /\d{1,32}/g, "收方账户填写错误!");
if ( e ) {
reject && reject(e);
return
}
e = _this.__check(ticketType, /\d{1}/g, "票据类型填写错误!");
if ( e ) {
reject && reject(e);
return
}
e = _this.__check(ticketNo, /\d{1,8}/g, "票据编号填写错误!");
if ( e ) {
reject && reject(e);
return
}
e = _this.__check(date, /^(?:(?:1[6-9]|[2-9][0-9])[0-9]{2}([-/.]?)(?:(?:0?[1-9]|1[0-2])\1(?:0?[1-9]|1[0-9]|2[0-8])|(?:0?[13-9]|1[0-2])\1(?:29|30)|(?:0?[13578]|1[02])\1(?:31))|(?:(?:1[6-9]|[2-9][0-9])(?:0[48]|[2468][048]|[13579][26])|(?:16|[2468][048]|[3579][26])00)([-/.]?)0?2\2(?:29))$/g, "时间填写错误!", reject);
if ( e ) {
reject && reject(e);
return
}
e = _this.__check(banlance, /\d{1,16}/g, "金额填写错误!");
if ( e ) {
reject && reject(e);
return
}
// if ( '4' == ticketType || '5' == ticketType ) {
// if ( undefined === accr || "" === accr ) {
// reject({
// code: "C0",
// msg: "票据类型为汇兑和其他时,收方账号必填。"
// })
// }
// }
if ( undefined === accr ) {
accr = ""