或筛选的遍历all筛选条件 for if request
const shuxing1 = response["xxx"]["shuxing1"];
const shuxing2 = response["xxx"]["shuxing2"];
const id = response["1509"]["id"]
const un_shuxing1 = [];
const un_shuxing2 = [];
const account = []
for(var i=0;i<shuxing1.length; i++){
if(shuxing1[i] != 1){
un_shuxing1.push(i)
}
}
eo.info("不符合shuxing1的有:"+un_shuxing1)
if(un_shuxing1.length!=0){
for(var i=0;i<un_shuxing1.length;i++){
if(shuxing2[un_shuxing1[i]]!="xxxxxx"){
un_shuxing2.push(un_shuxing1[i])
}
}
}
eo.info("不符合shuxing2的有:"+un_shuxing2)
if (un_shuxing2.length!=0){
for(var i=0;i<un_shuxing2.length;i++){
account.push(id[un_shuxing2[i]])
}
eo.error("xxxx")
eo.info("xxxx")
}
if (un_shuxing2.length!=0){
api = eo.env.param.get("api")
var request = {
"url": xxxxx,
"name": "xxxx",
"method": "GET",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
"timelimit": 1000
};
var res = eo.execute(request);
eo.info(res.response)
}
将数组改为合适的字符串 toString()
function jiequstr(a,b){
const stra = a.toString().substr(0,b)
return stra
}
const id = response["1509"]["id"]
var len = id.toString().length
eo.info(len)
eo.info(id)
const stra = jiequstr(id,len)
eo.info(stra)
eo.env.param.set("id_num",stra)
金额比较大小,改数据类型 Number()
amount_1 = response["1551"]["amount_1"][0]
amount_2 = response["1551"]["amount_2"][0]
amount_1 = Number(amount_1)
amount_2 = Number(amount_2)
if(amount_1 >= amount_2){
eo.info("排序正确")
}else if(amount_1 < amount_2){
eo.info("排序错误")
}else{
eo.info("aiaiai")
}
eo.info(amount_1+" "+amount_2)
eo.info(typeof amount_1)
时间比较,改数据类型 Date.parse()
var a = response["1286"]["000"][0]
var b = response["1286"]["111"][0]
if (a <= b){
eo.info("流失时间升序排序正确");
eo.info(a);
eo.info(b);
}else{
eo.error("流失时间升序排序错误");
eo.info(a);
eo.info(b);
}
var c = response["1289"]["000"][0]
var d = response["1289"]["111"][0]
if (c >= d){
eo.info("流失时间降序排序正确");
eo.info(c);
eo.info(d);
}else{
eo.error("流失时间降序排序错误");
eo.info(c);
eo.info(d);
}
var lose_maintain_last_time_1 = response["1553"]["lose_maintain_last_time_1"][0]
var lose_maintain_last_time_2 = response["1553"]["lose_maintain_last_time_2"][0]
var lose_maintain_last_time_1 = Date.parse(lose_maintain_last_time_1)
var lose_maintain_last_time_2 = Date.parse(lose_maintain_last_time_2)
if(lose_maintain_last_time_1>=lose_maintain_last_time_2){
eo.info("最近维护时间排序正确")
}else{
eo.error("最近维护时间排序错误")
}
eo.info(typeof lose_maintain_last_time_2)
eo.info(lose_maintain_last_time_2)