修改验证码逻辑,每次获取都更新新的验证码,更像随机数
This commit is contained in:
@@ -3,6 +3,21 @@
|
||||
//////////////////////////////////////////////////////////////////
|
||||
youle_agent.debug = true;
|
||||
|
||||
//更新手机验证码
|
||||
youle_agent.update_phone_code = function(phonenum, smmcode) {
|
||||
var idx = min_ary_indexof(youle_agent.phonecodes, phonenum, "phonenum");
|
||||
if (idx == -1){
|
||||
var info = {};
|
||||
info.phonenum = phonenum;
|
||||
info.smmcode = smmcode;
|
||||
info.sendtime = min_now();
|
||||
youle_agent.phonecodes.push(info);
|
||||
} else {
|
||||
youle_agent.phonecodes[idx].smmcode = smmcode;
|
||||
youle_agent.phonecodes[idx].sendtime = min_now();
|
||||
}
|
||||
}
|
||||
|
||||
//发送手机验证码
|
||||
youle_agent.send_phone_checkcode = function(pack){
|
||||
var agentid = pack.data.agentid;
|
||||
@@ -23,40 +38,17 @@ youle_agent.send_phone_checkcode = function(pack){
|
||||
config.data = md5Geturl3(13619576943, "xieyu2018", phonenum, md5memo);
|
||||
min_http(config);
|
||||
|
||||
var idx = min_ary_indexof(youle_agent.phonecodes, phonenum, "phonenum");
|
||||
if (idx == -1){
|
||||
var info = {};
|
||||
info.phonenum = phonenum;
|
||||
info.smmcode = smmcode;
|
||||
info.sendtime = min_now();
|
||||
youle_agent.phonecodes.push(info);
|
||||
} else {
|
||||
youle_agent.phonecodes[idx].smmcode = smmcode;
|
||||
youle_agent.phonecodes[idx].sendtime = min_now();
|
||||
}
|
||||
youle_agent.update_phone_code(phonenum, smmcode);
|
||||
return pack;
|
||||
}
|
||||
//发送手机验证码-微信小程序版本
|
||||
youle_agent.send_phone_code_wechat = function(pack){
|
||||
var agentid = pack.data.agentid;
|
||||
|
||||
var phonenum = pack.data.phonenum;
|
||||
|
||||
|
||||
|
||||
var smmcode = min_random(1000, 9999);
|
||||
|
||||
|
||||
var idx = min_ary_indexof(youle_agent.phonecodes, phonenum, "phonenum");
|
||||
if (idx == -1){
|
||||
var info = {};
|
||||
info.phonenum = phonenum;
|
||||
info.smmcode = smmcode;
|
||||
info.sendtime = min_now();
|
||||
youle_agent.phonecodes.push(info);
|
||||
} else {
|
||||
youle_agent.phonecodes[idx].smmcode = smmcode;
|
||||
youle_agent.phonecodes[idx].sendtime = min_now();
|
||||
}
|
||||
youle_agent.update_phone_code(phonenum, smmcode);
|
||||
pack.data.smmcode = smmcode;
|
||||
return pack;
|
||||
}
|
||||
|
||||
@@ -83,16 +75,7 @@ youle_agent.get_phone_code_wechat = function(pack){
|
||||
|
||||
if (smmcode == 0){
|
||||
smmcode = min_random(1000, 9999);
|
||||
if (idx == -1){
|
||||
var info = {};
|
||||
info.phonenum = phonenum;
|
||||
info.smmcode = smmcode;
|
||||
info.sendtime = min_now();
|
||||
youle_agent.phonecodes.push(info);
|
||||
} else {
|
||||
youle_agent.phonecodes[idx].smmcode = smmcode;
|
||||
youle_agent.phonecodes[idx].sendtime = min_now();
|
||||
}
|
||||
youle_agent.update_phone_code(phonenum, smmcode);
|
||||
}
|
||||
|
||||
pack.data.smmcode = smmcode;
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
"tabIndent": "insertSpaces",
|
||||
"tabSize": 2
|
||||
},
|
||||
"libVersion": "3.12.1",
|
||||
"libVersion": "3.14.1",
|
||||
"packOptions": {
|
||||
"ignore": [],
|
||||
"include": []
|
||||
|
||||
@@ -464,7 +464,7 @@ app.post('/api/getPhoneCode', async (req, res) => {
|
||||
const payload = {
|
||||
"app": "youle",
|
||||
"route": "agent",
|
||||
"rpc": "get_phone_code_wechat",
|
||||
"rpc": "send_phone_code_wechat",
|
||||
"data": {
|
||||
"agentid": agentid,
|
||||
"phonenum": phonenum
|
||||
|
||||
Reference in New Issue
Block a user