mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-06 11:26:27 +00:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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,40 @@ 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}`
|
||||||
|
);
|
||||||
|
|
||||||
|
if ((parseInt(lastFlag) <= parseInt(flag)) || (parseInt(lastFlag) == 255 && parseInt(flag) == 0)) {
|
||||||
|
|
||||||
|
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;
|
||||||
|
|||||||
@@ -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;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user