This commit is contained in:
Victor Sanchez Sosa 2024-02-08 17:03:24 -05:00
parent dc5fb6b55a
commit 585e406cd4
3 changed files with 45 additions and 40 deletions

View File

@ -153,20 +153,27 @@ async function ConsultaClaves(cedula, chang = null){
var array = {'ok': false, 'data':[], 'msg':null}; var array = {'ok': false, 'data':[], 'msg':null};
var _ur = 'consulta_predios_detalle/2/'+cedula+'?boot=true'; var _ur = 'consulta_predios_detalle/2/'+cedula+'?boot=true';
if(chang != null){ if(chang != null){
var _ur = 'consulta_predios_detalle/1/'+cedula+'?boot=true&cc=1'; var _ur = 'consulta_predios_detalle/1/'+cedula+'?boot=true';
} }
console.log(_ur); console.log(_ur);
AxiosGET(_ur, {}).then(function (result) { AxiosGET(_ur, {}).then(function (result) {
if(result['ok'] && result['data_bot']['data'].length > 0){ if(result['ok']){
array['ok'] = true; array['data'] = result['data_bot']['data']; array['msg'] = 'Consulta exitosa'; array['ok'] = true;
}else{ array['data'] = result['data_bot'];
array['msg'] = 'el número de cédula '+cedula+' no posee predios catastrales registrados en el GAD MANTA'; array['msg'] = 'Consulta exitosa';
if(chang != null){ }else{
array['msg'] = 'la clave catastral '+cedula+' no existe en los registros del GAD MANTA'; array['msg'] = result['message'];
}
} }
console.log("array procedure server"); // if(result['ok'] && result['data_bot']['data'].length > 0){
console.log(array); // array['ok'] = true; array['data'] = result['data_bot']['data']; array['msg'] = 'Consulta exitosa';
// }else{
// array['msg'] = 'el número de cédula '+cedula+' no posee predios catastrales registrados en el GAD MANTA';
// if(chang != null){
// array['msg'] = 'la clave catastral '+cedula+' no existe en los registros del GAD MANTA';
// }
// }
// console.log("array procedure server");
// console.log(array);
resolve(array); resolve(array);
}).catch(function (error) { }).catch(function (error) {
array['msg'] = error; array['msg'] = error;

View File

@ -193,7 +193,7 @@ app.post("/webhook", express.json(), function (req, res) {
let port = 3000; let port = process.env.port || 3092;
app.listen(port, () => { app.listen(port, () => {
console.log("Estamos ejecutando el servidor en el puerto " + port); console.log("Estamos ejecutando el servidor en el puerto " + port);
}); });

View File

@ -656,39 +656,37 @@ async function Fun_ConsultarClavesCatastrales(agent, req, res, _cedula = null, n
const regex = /^[0-9]*$/; const regex = /^[0-9]*$/;
_cedula = _cedula.replace(/-/g, ""); _cedula = _cedula.replace(/-/g, "");
if (regex.test(_cedula)) { if (regex.test(_cedula)) {
console.log('legion')
let legion = await funcion.ConsultaClaves(_cedula, nuevo); let legion = await funcion.ConsultaClaves(_cedula, nuevo);
console.log(legion) console.log(legion)
if (legion['ok'] == true) { if (legion['ok'] == true) {
let coun = legion['data'].length; // let mensjae_predios = '';
let mensjae_predios = ''; // legion['data'].forEach((element, index) => {
legion['data'].forEach((element, index) => { // var rec = element['valor']['boot']['anteriores'];
var rec = element['valor']['boot']['anteriores'];
if (element['valor']['boot']['total'] != null) { // if (element['valor']['boot']['total'] != null) {
if (element['valor']['boot']['anteriores'] == 'Recaudación al día') { // if (element['valor']['boot']['anteriores'] == 'Recaudación al día') {
rec = element['valor']['boot']['actual'] + '\n' + element['valor']['boot']['total']; // rec = element['valor']['boot']['actual'] + '\n' + element['valor']['boot']['total'];
}else{ // }else{
rec += '\n' + element['valor']['boot']['actual'] + '\n' + element['valor']['boot']['total']; // rec += '\n' + element['valor']['boot']['actual'] + '\n' + element['valor']['boot']['total'];
} // }
} // }
if (mensjae_predios.length > 0) { // if (mensjae_predios.length > 0) {
mensjae_predios += '\n\n'; // mensjae_predios += '\n\n';
} // }
mensjae_predios += element['text'] + '\n' + element['direccion'] + '\n' + rec; // mensjae_predios += element['text'] + '\n' + element['direccion'] + '\n' + rec;
// if (index == (coun - 1)) { // // if (index == (coun - 1)) {
// mensjae_predios += element['text'] + '\n' + element['direccion'] + '\n' + rec; // // mensjae_predios += element['text'] + '\n' + element['direccion'] + '\n' + rec;
// // agent.add(element['text'] + '\n' + element['direccion'] + '\n' + rec); // // // agent.add(element['text'] + '\n' + element['direccion'] + '\n' + rec);
// // return Fun_RetornarAlinicio(agent, req, res, funcion.conver_name(data_context.name)); // // // return Fun_RetornarAlinicio(agent, req, res, funcion.conver_name(data_context.name));
// } else { // // } else {
// mensjae_predios += element['text'] + '\n' + element['direccion'] + '\n' + rec; // // mensjae_predios += element['text'] + '\n' + element['direccion'] + '\n' + rec;
// // agent.add(element['text'] + '\n' + funcion.conver_capitalice(element['direccion']) + '\n' + rec); // // // agent.add(element['text'] + '\n' + funcion.conver_capitalice(element['direccion']) + '\n' + rec);
// } // // }
}); // });
// if (mensjae_predios.length > 0) {
if (mensjae_predios.length > 0) { // agent.add(mensjae_predios);
agent.add(mensjae_predios); // }
} agent.add(legion['data_text']);
return Fun_RetornarAlinicio(agent, req, res, funcion.conver_name(data_context.name)); return Fun_RetornarAlinicio(agent, req, res, funcion.conver_name(data_context.name));
} else { } else {
agent.add(funcion.conver_name(data_context.name) + ', ' + legion['msg']); agent.add(funcion.conver_name(data_context.name) + ', ' + legion['msg']);