_
This commit is contained in:
parent
9bbe3e5d2f
commit
dc5fb6b55a
@ -1,7 +1,7 @@
|
|||||||
const { error } = require('actions-on-google/dist/common');
|
const { error } = require('actions-on-google/dist/common');
|
||||||
const axios= require('axios');
|
const axios= require('axios');
|
||||||
const URLIC = 'https://sistemasic.manta.gob.ec/';
|
const URLIC = 'https://sistemasic.manta.gob.ec/';
|
||||||
const URLPC = 'http://mantaentusmanos.test/';
|
const URLPC = 'https://portalciudadano.manta.gob.ec/';
|
||||||
// const URLPC = 'https://portalciudadano.manta.gob.ec/';
|
// const URLPC = 'https://portalciudadano.manta.gob.ec/';
|
||||||
const { WebhookClient } = require("dialogflow-fulfillment");
|
const { WebhookClient } = require("dialogflow-fulfillment");
|
||||||
|
|
||||||
@ -165,6 +165,8 @@ async function ConsultaClaves(cedula, chang = null){
|
|||||||
array['msg'] = 'la clave catastral '+cedula+' no existe en los registros del GAD MANTA';
|
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;
|
||||||
|
|||||||
2
index.js
2
index.js
@ -193,7 +193,7 @@ app.post("/webhook", express.json(), function (req, res) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
let port = 4000;
|
let port = 3000;
|
||||||
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);
|
||||||
});
|
});
|
||||||
36
metodos.js
36
metodos.js
@ -450,7 +450,7 @@ async function Fun_ConsultaPredios(agent, req, res) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function Fun_RetornarAlinicio(agent, req, res, name) {
|
async function Fun_RetornarAlinicio(agent, req, res, name, text = "") {
|
||||||
agent.context.set({
|
agent.context.set({
|
||||||
name: '0-Bienvenida-followup',
|
name: '0-Bienvenida-followup',
|
||||||
lifespan: 1
|
lifespan: 1
|
||||||
@ -661,19 +661,35 @@ async function Fun_ConsultarClavesCatastrales(agent, req, res, _cedula = null, n
|
|||||||
console.log(legion)
|
console.log(legion)
|
||||||
if (legion['ok'] == true) {
|
if (legion['ok'] == true) {
|
||||||
let coun = legion['data'].length;
|
let coun = legion['data'].length;
|
||||||
|
let mensjae_predios = '';
|
||||||
legion['data'].forEach((element, index) => {
|
legion['data'].forEach((element, index) => {
|
||||||
console.log(element['valor'])
|
|
||||||
var rec = element['valor']['boot']['anteriores'];
|
var rec = element['valor']['boot']['anteriores'];
|
||||||
if (element['valor']['boot']['anteriores'] != 'Recaudación al día') {
|
|
||||||
rec = rec + '\n' + element['valor']['boot']['actual'] + '\n' + element['valor']['boot']['total']
|
if (element['valor']['boot']['total'] != null) {
|
||||||
}
|
if (element['valor']['boot']['anteriores'] == 'Recaudación al día') {
|
||||||
if (index == (coun - 1)) {
|
rec = element['valor']['boot']['actual'] + '\n' + element['valor']['boot']['total'];
|
||||||
agent.add(element['text'] + '\n' + element['direccion'] + '\n' + rec);
|
|
||||||
return Fun_RetornarAlinicio(agent, req, res, funcion.conver_name(data_context.name));
|
|
||||||
}else{
|
}else{
|
||||||
agent.add(element['text'] + '\n' + funcion.conver_capitalice(element['direccion']) + '\n' + rec);
|
rec += '\n' + element['valor']['boot']['actual'] + '\n' + element['valor']['boot']['total'];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (mensjae_predios.length > 0) {
|
||||||
|
mensjae_predios += '\n\n';
|
||||||
|
}
|
||||||
|
mensjae_predios += element['text'] + '\n' + element['direccion'] + '\n' + rec;
|
||||||
|
// if (index == (coun - 1)) {
|
||||||
|
// mensjae_predios += 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));
|
||||||
|
// } else {
|
||||||
|
// mensjae_predios += element['text'] + '\n' + element['direccion'] + '\n' + rec;
|
||||||
|
// // agent.add(element['text'] + '\n' + funcion.conver_capitalice(element['direccion']) + '\n' + rec);
|
||||||
|
// }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (mensjae_predios.length > 0) {
|
||||||
|
agent.add(mensjae_predios);
|
||||||
|
}
|
||||||
|
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']);
|
||||||
return Fun_RetornarAlinicio(agent, req, res, funcion.conver_name(data_context.name));
|
return Fun_RetornarAlinicio(agent, req, res, funcion.conver_name(data_context.name));
|
||||||
@ -691,6 +707,8 @@ async function Fun_ConsultarClavesCatastrales(agent, req, res, _cedula = null, n
|
|||||||
return Fun_WelcomeAgent(agent, req, res);
|
return Fun_WelcomeAgent(agent, req, res);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.log("error");
|
||||||
|
console.log(error);
|
||||||
return ResolveDefauld(agent);
|
return ResolveDefauld(agent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2288
package-lock.json
generated
2288
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -12,7 +12,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"actions-on-google": "^2.14.0",
|
"actions-on-google": "^2.14.0",
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
"dialogflow-fulfillment": "0.6.0",
|
"dialogflow-fulfillment": "^0.6.0",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"nodemon": "^2.0.7"
|
"nodemon": "^2.0.7"
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user