escolares sybase node
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
require('../config/config');
|
||||
require('./config');
|
||||
const Sybase = require('sybase');
|
||||
const db = new Sybase(
|
||||
process.env.SYBASE_IP,
|
||||
@@ -13,11 +13,10 @@ const alumno = (numeroCuenta) => {
|
||||
db.connect((err) => {
|
||||
if (err) reject(err);
|
||||
db.query(
|
||||
`select * from servicio_social where cuenta = '${numeroCuenta}'`,
|
||||
`select * from servicio_social where cuenta = "${numeroCuenta}"`,
|
||||
(err, data) => {
|
||||
if (err) reject(err);
|
||||
db.disconnect();
|
||||
console.log(data);
|
||||
resolve(data);
|
||||
}
|
||||
);
|
||||
@@ -25,10 +24,4 @@ const alumno = (numeroCuenta) => {
|
||||
});
|
||||
};
|
||||
|
||||
const exec = async () => {
|
||||
let a = await alumno('415112132');
|
||||
|
||||
console.log(a);
|
||||
};
|
||||
|
||||
exec();
|
||||
module.exports = alumno;
|
||||
@@ -1,4 +1,5 @@
|
||||
require('../../config/config');
|
||||
const sybase = require('../../config/sybase');
|
||||
const validar = require('../../helper/validar');
|
||||
const axios = require('axios');
|
||||
const Usuario = require('../../db/tablas/Usuario');
|
||||
@@ -8,11 +9,12 @@ const escolares = async (body) => {
|
||||
const numeroCuenta = validar.validarNumeroCuenta(body.numeroCuenta);
|
||||
let alumno;
|
||||
|
||||
return axios({
|
||||
method: 'post',
|
||||
url: `${process.env.ESCOLARES}${numeroCuenta}`,
|
||||
data: `${process.env.ESCOLARES_PASS}`,
|
||||
})
|
||||
// return axios({
|
||||
// method: 'post',
|
||||
// url: `${process.env.ESCOLARES}${numeroCuenta}`,
|
||||
// data: `${process.env.ESCOLARES_PASS}`,
|
||||
// })
|
||||
return sybase(numeroCuenta)
|
||||
.then((res) => {
|
||||
if (!res.data.nombre || !res.data.carrconst || !res.data.avance)
|
||||
throw new Error(
|
||||
|
||||
Reference in New Issue
Block a user