Compare commits

..

25 Commits

Author SHA1 Message Date
ihsan 9af6f4f823 bug fixed 2025-03-26 15:17:56 +07:00
ihsan 5259fd89ef chnage version 2025-03-26 05:24:29 +07:00
ihsan 0e35368e22 handling max flag 255 2025-03-24 21:26:59 +07:00
ihsan 0fdc901193 change logic 2025-03-24 16:44:02 +07:00
ihsan c3a458313e bug fixed flag 0 auto clear 2025-03-24 09:24:51 +07:00
ihsan 8ed7e738ab bug fixed log 2025-03-21 13:59:40 +07:00
ihsan 11b2ff8721 remove debug log 2025-03-21 13:56:21 +07:00
ihsan 851f1b14f6 update 2025-03-21 13:51:11 +07:00
ihsan 67c33c8e1f add debug log 2025-03-21 13:48:07 +07:00
ihsan ad8951c567 update 2025-03-21 11:19:52 +07:00
ihsan 5da07d9330 bug fixed 2025-03-21 11:14:12 +07:00
ihsan a680bc235d bug fixed 2025-03-21 11:09:46 +07:00
ihsan 269ae0088d add log debug 2025-03-21 11:03:36 +07:00
ihsan fe6fe9e72e bug fixed 2025-03-21 10:46:00 +07:00
ihsan 060c9d0b0b bug fixed variable 2025-03-21 10:38:34 +07:00
ihsan 7eff55e7f3 bug fixed max flag 255 2025-03-21 10:27:04 +07:00
ihsan 810d432374 bugs fixed 2025-03-21 10:13:49 +07:00
ihsan 687521146e Merge branch 'develop' of https://github.com/mohamadihsan/topuponline into develop 2025-03-21 10:09:42 +07:00
ihsan e82a09187c update query load balance if found flag has been 255 2025-03-21 10:09:36 +07:00
WildanFahri 3a8e2976f0 bug fixing 2025-03-10 15:07:40 +07:00
WildanFahri 530b5eed7e bug fixed 2025-03-05 13:48:55 +07:00
WildanFahri e9e9bbf4c8 bug fixing 2025-03-05 13:34:47 +07:00
WildanFahri 29c8f60135 bug fixing 2025-03-05 12:44:54 +07:00
WildanFahri cc497f606b bug fixing 2025-03-05 12:35:42 +07:00
WildanFahri c17e56731f bug fixing 2025-03-05 12:10:24 +07:00
3 changed files with 71 additions and 8 deletions
@@ -430,7 +430,15 @@ const updateAllTransaction = async (
const loadingBalanceRequest = async (req, res) => {
try {
// 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();
let uniqueCode = unique_code;
@@ -710,9 +718,45 @@ const loadingBalanceRequest = async (req, res) => {
// let getReservationPendingWithFlag =
// 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 (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 loadBalanceNumberPendingSuccessLoaded = [];
let totalReservationAmount = 0;
@@ -2103,7 +2147,7 @@ const loadingBalanceUpdate = async (param) => {
// log info
winston.logger.info(
`${uniqueCode} [ RESPONSE LOADING-BALANCE-INSERT ]: ${JSON.stringify(
`${uniqueCode} [ RESPONSE LOADING-BALANCE-UPDATE ]: ${JSON.stringify(
result
)}`
);
@@ -119,7 +119,24 @@ const getReservationPendingV2 = (cardNumber, time, flag) => {
// GET RESERVATION PENDING WITH COMPARE FLAG COUNTER
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")
// .count("* as total_reservation")
.select(
@@ -133,6 +150,8 @@ const getReservationPendingWithFlagCounter = (cardNumber, time, flag) => {
.whereRaw('??::INT < ??', ['c_flag', parseInt(flag)])
// .where("d_expired", ">=", time)
.where('c_flag', '!=', '-1');
}
return result;
};
@@ -397,11 +416,11 @@ const insertLoadingBalance = async (
.catch(trx.rollback);
})
.then((result) => {
// console.log(result);
// console.log("result insertLoadingBalance", result);
return result.rowCount;
})
.catch((error) => {
// console.log(error.message);
// console.log("error.message insertLoadingBalance", error.message);
return error.message;
});
};
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "topuponline",
"version": "1.5.7",
"description": "change file rotate log from 90 days to 60 days",
"version": "1.6.0",
"description": "handling maximum flag 255",
"main": "index.js",
"scripts": {
"start": "nodemon index",