1
0
mirror of https://dev.s-ul.net/Galexion/MaiMaiDXNet.git synced 2025-02-17 17:58:31 +01:00

94 lines
3.9 KiB
JavaScript
Raw Normal View History

2023-02-16 18:50:32 -05:00
var express = require('express');
var router = express.Router();
var fetch = require('cross-fetch');
const sqlite3 = require('sqlite3').verbose();
let db = new sqlite3.Database('A:\\db.sqlite');
router.post('/getExtId/', function (req, res, next) {
db.all('SELECT * FROM sega_card', (err, rows) => {
if (err) {
console.error(err);
// Return a Failed Message.
res.status(500).json({ error: err.message, status: "Failed" });
} else {
// Make the Request easier to get to.
var request = req.body;
var mUser = undefined // Leave the Matched User undefined until the user is found.
for (user of rows) { // For Each User in Rows
if (request.input === user.luid) { // If the Access Code for the card is in the system,
mUser = user; // set the Matched User Variable to the User, and break the for Loop.
break
}
}
// Return a Response with the whole identifiable user data. the EXT_ID will be used later to identify images and other things and match them to the user's profile.
res.status(200).json({ data: mUser, status: "Complete" });
}
});
});
router.post('/getUserData/', function (req,res,next) {
db.all('SELECT * FROM maimai2_user_detail', (err, rows) => {
if (err) {
console.error(err);
// Return a Failed Message.
res.status(500).json({ error: err.message, status: "Failed" });
} else {
// Make the Request easier to get to.
var request = req.body;
var mUser = undefined // Leave the Matched User undefined until the user is found.
for (user of rows) { // For Each User in Rows
if (request.input === user.aime_card_id) { // If the Access Code for the card is in the system,
mUser = user; // set the Matched User Variable to the User, and break the for Loop.
break
}
}
// Return a Response with the whole identifiable user data. the EXT_ID will be used later to identify images and other things and match them to the user's profile.
res.status(200).json({ data: mUser, status: "Complete" });
}
});
})
2023-02-18 05:19:30 -05:00
router.post('/getUserScores/', function (req,res,next) {
db.all('SELECT * FROM maimai2_user_playlog', (err, rows) => {
if (err) {
console.error(err);
// Return a Failed Message.
res.status(500).json({ error: err.message, status: "Failed" });
} else {
// Make the Request easier to get to.
var request = req.body;
var mUser = new Array(); // Leave the Matched User's Scores undefined until the user is found.
for (score of rows) { // For Each Score in Rows
if (request.input == score.user_id) { // If the inputed User ID and Score's User ID Matches,
mUser.push(score) // add that score into the array.
}
}
// Return a Response with all the Scores listed under that user.
res.status(200).json({ data: mUser, status: "Complete" });
}
});
});
2023-02-25 08:30:21 -05:00
router.post('/getUserArea/', function (req,res,next) {
db.all('SELECT * FROM maimai2_user_map', (err, rows) => {
if (err) {
console.error(err);
// Return a Failed Message.
res.status(500).json({ error: err.message, status: "Failed" });
} else {
// Make the Request easier to get to.
var request = req.body;
var mUser = new Array(); // Leave the Matched User's Areas undefined until the user is found.
for (map of rows) { // For Each Area in Rows
if (request.input == map.user_id) { // If the inputed User ID and Score's User ID Matches,
mUser.push(map) // add that Area into the array.
}
}
// Return a Response with all the Areas listed under that user.
res.status(200).json({ data: mUser, status: "Complete" });
}
});
});
2023-02-16 18:50:32 -05:00
module.exports = router;