mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-06 09:06:27 +00:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9af6f4f823 | |||
| 5259fd89ef | |||
| 0e35368e22 | |||
| 0fdc901193 | |||
| c3a458313e | |||
| 8ed7e738ab | |||
| 11b2ff8721 | |||
| 851f1b14f6 | |||
| 67c33c8e1f | |||
| ad8951c567 | |||
| 5da07d9330 | |||
| a680bc235d | |||
| 269ae0088d | |||
| fe6fe9e72e | |||
| 060c9d0b0b | |||
| 7eff55e7f3 | |||
| 810d432374 | |||
| 687521146e | |||
| e82a09187c | |||
| 3a8e2976f0 | |||
| 530b5eed7e | |||
| e9e9bbf4c8 | |||
| 29c8f60135 | |||
| cc497f606b | |||
| c17e56731f |
@@ -430,7 +430,15 @@ const updateAllTransaction = async (
|
|||||||
const loadingBalanceRequest = async (req, res) => {
|
const loadingBalanceRequest = async (req, res) => {
|
||||||
try {
|
try {
|
||||||
// param
|
// param
|
||||||
let { mid, tid, card_number, uid, balance, flag, unique_code } = req.body;
|
// let { mid, tid, card_number, uid, balance, flag, unique_code } = req.body;
|
||||||
|
|
||||||
|
let mid = req.body.mid;
|
||||||
|
let tid = req.body.tid;
|
||||||
|
let card_number = req.body.card_number;
|
||||||
|
let uid = req.body.uid;
|
||||||
|
let balance = req.body.balance;
|
||||||
|
let flag = req.body.flag;
|
||||||
|
let unique_code = req.body.unique_code;
|
||||||
|
|
||||||
// uniqueCode = await helper.getUniqueCode();
|
// uniqueCode = await helper.getUniqueCode();
|
||||||
let uniqueCode = unique_code;
|
let uniqueCode = unique_code;
|
||||||
@@ -710,9 +718,45 @@ const loadingBalanceRequest = async (req, res) => {
|
|||||||
// let getReservationPendingWithFlag =
|
// let getReservationPendingWithFlag =
|
||||||
// await model.getReservationPendingWithFlag(card_number, now);
|
// await model.getReservationPendingWithFlag(card_number, now);
|
||||||
|
|
||||||
|
winston.logger.warn(
|
||||||
|
`${uniqueCode} [ RESPONSE LOADING-BALANCE-REQUEST DEBUG X ]: ${JSON.stringify(
|
||||||
|
getReservationPendingWithFlagCounter
|
||||||
|
)}`
|
||||||
|
);
|
||||||
|
|
||||||
|
// winston.logger.warn(
|
||||||
|
// `${uniqueCode} [ RESPONSE LOADING-BALANCE-REQUEST DEBUG 1.1 ]: ${JSON.stringify(
|
||||||
|
// getReservationPending
|
||||||
|
// )}`
|
||||||
|
// );
|
||||||
|
|
||||||
|
|
||||||
|
// winston.logger.warn(
|
||||||
|
// `${uniqueCode} [ RESPONSE LOADING-BALANCE-REQUEST DEBUG 2 ]: ${JSON.stringify(req.body)}`
|
||||||
|
// );
|
||||||
|
|
||||||
|
// winston.logger.warn(
|
||||||
|
// `${uniqueCode} [ RESPONSE LOADING-BALANCE-REQUEST DEBUG 2.1 ]: ${flag}`
|
||||||
|
// );
|
||||||
|
|
||||||
if (getReservationPendingWithFlagCounter.length > 0) {
|
if (getReservationPendingWithFlagCounter.length > 0) {
|
||||||
if (lastFlag) {
|
if (lastFlag) {
|
||||||
if (parseInt(lastFlag) <= parseInt(flag)) {
|
|
||||||
|
winston.logger.warn(
|
||||||
|
`${uniqueCode} [ RESPONSE LOADING-BALANCE-REQUEST DEBUG Y ]: ${card_number}`
|
||||||
|
);
|
||||||
|
|
||||||
|
// manipulasi last flag jika flag kartu sudah kembali ke 0
|
||||||
|
if (parseInt(lastFlag) == 255 && parseInt(flag) == 0) {
|
||||||
|
lastFlag = -1
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parseInt(lastFlag) < parseInt(flag)) {
|
||||||
|
|
||||||
|
winston.logger.warn(
|
||||||
|
`${uniqueCode} [ RESPONSE LOADING-BALANCE-REQUEST DEBUG Z ]: ${card_number}`
|
||||||
|
);
|
||||||
|
|
||||||
let reservationNumberPendingSuccessLoaded = [];
|
let reservationNumberPendingSuccessLoaded = [];
|
||||||
let loadBalanceNumberPendingSuccessLoaded = [];
|
let loadBalanceNumberPendingSuccessLoaded = [];
|
||||||
let totalReservationAmount = 0;
|
let totalReservationAmount = 0;
|
||||||
@@ -2103,7 +2147,7 @@ const loadingBalanceUpdate = async (param) => {
|
|||||||
|
|
||||||
// log info
|
// log info
|
||||||
winston.logger.info(
|
winston.logger.info(
|
||||||
`${uniqueCode} [ RESPONSE LOADING-BALANCE-INSERT ]: ${JSON.stringify(
|
`${uniqueCode} [ RESPONSE LOADING-BALANCE-UPDATE ]: ${JSON.stringify(
|
||||||
result
|
result
|
||||||
)}`
|
)}`
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -119,7 +119,24 @@ const getReservationPendingV2 = (cardNumber, time, flag) => {
|
|||||||
|
|
||||||
// GET RESERVATION PENDING WITH COMPARE FLAG COUNTER
|
// GET RESERVATION PENDING WITH COMPARE FLAG COUNTER
|
||||||
const getReservationPendingWithFlagCounter = (cardNumber, time, flag) => {
|
const getReservationPendingWithFlagCounter = (cardNumber, time, flag) => {
|
||||||
let result = knex('trx.t_d_reservation_balance')
|
let result
|
||||||
|
if (flag == '0' || flag == 0) {
|
||||||
|
result = knex('trx.t_d_reservation_balance')
|
||||||
|
// .sum("i_reservation_amount as total_reservation_amount")
|
||||||
|
// .count("* as total_reservation")
|
||||||
|
.select(
|
||||||
|
'i_reservation_amount',
|
||||||
|
'c_reservation_no',
|
||||||
|
'c_flag',
|
||||||
|
'c_load_balance_no'
|
||||||
|
)
|
||||||
|
.where('c_card_number', cardNumber)
|
||||||
|
.whereIn('c_status', ['P', 'I'])
|
||||||
|
.whereRaw('??::INT <= ??', ['c_flag', parseInt(255)])
|
||||||
|
// .where("d_expired", ">=", time)
|
||||||
|
.where('c_flag', '!=', '-1');
|
||||||
|
} else {
|
||||||
|
result = knex('trx.t_d_reservation_balance')
|
||||||
// .sum("i_reservation_amount as total_reservation_amount")
|
// .sum("i_reservation_amount as total_reservation_amount")
|
||||||
// .count("* as total_reservation")
|
// .count("* as total_reservation")
|
||||||
.select(
|
.select(
|
||||||
@@ -133,6 +150,8 @@ const getReservationPendingWithFlagCounter = (cardNumber, time, flag) => {
|
|||||||
.whereRaw('??::INT < ??', ['c_flag', parseInt(flag)])
|
.whereRaw('??::INT < ??', ['c_flag', parseInt(flag)])
|
||||||
// .where("d_expired", ">=", time)
|
// .where("d_expired", ">=", time)
|
||||||
.where('c_flag', '!=', '-1');
|
.where('c_flag', '!=', '-1');
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -397,11 +416,11 @@ const insertLoadingBalance = async (
|
|||||||
.catch(trx.rollback);
|
.catch(trx.rollback);
|
||||||
})
|
})
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
// console.log(result);
|
// console.log("result insertLoadingBalance", result);
|
||||||
return result.rowCount;
|
return result.rowCount;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
// console.log(error.message);
|
// console.log("error.message insertLoadingBalance", error.message);
|
||||||
return error.message;
|
return error.message;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "topuponline",
|
"name": "topuponline",
|
||||||
"version": "1.5.7",
|
"version": "1.6.0",
|
||||||
"description": "change file rotate log from 90 days to 60 days",
|
"description": "handling maximum flag 255",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "nodemon index",
|
"start": "nodemon index",
|
||||||
|
|||||||
Reference in New Issue
Block a user