|
|
@@ -638,10 +638,12 @@ const fetchGamesRelation = async (mk='') => {
|
|
|
const nowTime = Date.now();
|
|
|
const gamesRelation = resData.data?.filter?.((item) => {
|
|
|
const timestamp = new Date(item.timestamp).getTime();
|
|
|
+ const updated = new Date(item.updated_at).getTime();
|
|
|
if (nowTime > timestamp) {
|
|
|
item.mk = 2;
|
|
|
}
|
|
|
item.timestamp = timestamp;
|
|
|
+ item.updated = updated;
|
|
|
const expireTime = timestamp + 1000*60*60*3;
|
|
|
return expireTime > nowTime;
|
|
|
}).map(item => {
|
|
|
@@ -657,6 +659,10 @@ const fetchGamesRelation = async (mk='') => {
|
|
|
hg_event_id, hg_league_id,
|
|
|
hg_team_home_name,
|
|
|
hg_team_away_name,
|
|
|
+ im_event_id, im_league_id,
|
|
|
+ im_team_home_name,
|
|
|
+ im_team_away_name,
|
|
|
+ updated,
|
|
|
timestamp,
|
|
|
} = item;
|
|
|
const rel = {
|
|
|
@@ -683,9 +689,17 @@ const fetchGamesRelation = async (mk='') => {
|
|
|
teamHomeName: hg_team_home_name,
|
|
|
teamAwayName: hg_team_away_name,
|
|
|
timestamp
|
|
|
+ } : null,
|
|
|
+ im: im_event_id ? {
|
|
|
+ eventId: +im_event_id,
|
|
|
+ leagueId: +im_league_id,
|
|
|
+ leagueName: league_name,
|
|
|
+ teamHomeName: im_team_home_name,
|
|
|
+ teamAwayName: im_team_away_name,
|
|
|
+ timestamp
|
|
|
} : null
|
|
|
};
|
|
|
- return { id: ps_event_id, mk, rel, timestamp };
|
|
|
+ return { id: ps_event_id, mk, rel, timestamp, updated };
|
|
|
}) ?? [];
|
|
|
return gamesRelation;
|
|
|
}
|
|
|
@@ -773,7 +787,7 @@ const getGamesRelation = ({ mk=-1, ids, listEvents=false, listPC=false } = {}) =
|
|
|
const updateGamesRelation = () => {
|
|
|
fetchGamesRelation()
|
|
|
.then(gamesRelation => {
|
|
|
-
|
|
|
+ // Logs.out('updateGamesRelation', gamesRelation);
|
|
|
const baseList = {};
|
|
|
gamesRelation.map(item => {
|
|
|
const baseGame = item.rel?.['ps'] ?? {};
|
|
|
@@ -797,7 +811,7 @@ const updateGamesRelation = () => {
|
|
|
};
|
|
|
|
|
|
gamesRelation.forEach(item => {
|
|
|
- const { id, mk } = item;
|
|
|
+ const { id, mk, updated } = item;
|
|
|
const oldItem = GAMES.Relations[id];
|
|
|
if (!oldItem) {
|
|
|
GAMES.Relations[id] = item;
|
|
|
@@ -807,6 +821,10 @@ const updateGamesRelation = () => {
|
|
|
GAMES.Relations[id] = item;
|
|
|
updateCount.update ++;
|
|
|
}
|
|
|
+ else if ((oldItem.updated ?? -1) < updated) {
|
|
|
+ GAMES.Relations[id] = item;
|
|
|
+ updateCount.update ++;
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
const relations = new Set(gamesRelation.map(item => +item.id));
|
|
|
@@ -1336,26 +1354,31 @@ const syncQbossConfig = () => {
|
|
|
const {
|
|
|
qboss_return_ratio,
|
|
|
ob_return_ratio, ob_return_type, ob_odds_more_than,
|
|
|
+ im_return_ratio, im_return_type, im_odds_more_than,
|
|
|
hg_return_ratio, hg_return_type, hg_odds_more_than,
|
|
|
pc_return_ratio, pc_return_type,
|
|
|
qboss_jq_add_odds, qboss_jq_add_hours,
|
|
|
qboss_gq_add_dy_odds, qboss_gq_add_jq_odds,
|
|
|
} = data.data;
|
|
|
const qbossSetting = {
|
|
|
- innerRebateRatio: +qboss_return_ratio,
|
|
|
- obRebateRatio: +ob_return_ratio,
|
|
|
- obRebateType: +ob_return_type,
|
|
|
- obMaxDiff: +ob_odds_more_than,
|
|
|
- hgRebateRatio: +hg_return_ratio,
|
|
|
- hgRebateType: +hg_return_type,
|
|
|
- hgMaxDiff: +hg_odds_more_than,
|
|
|
- pcRebateRatio: +pc_return_ratio,
|
|
|
- pcRebateType: +pc_return_type,
|
|
|
- subsidyTime: +qboss_jq_add_hours,
|
|
|
- subsidyAmount: +qboss_jq_add_odds,
|
|
|
- subsidyRbWmAmount: +qboss_gq_add_dy_odds,
|
|
|
- subsidyRbOtAmount: +qboss_gq_add_jq_odds,
|
|
|
+ innerRebateRatio: qboss_return_ratio ? +qboss_return_ratio : 0,
|
|
|
+ obRebateRatio: ob_return_ratio ? +ob_return_ratio : 0,
|
|
|
+ obRebateType: ob_return_type ? +ob_return_type : 0,
|
|
|
+ obMaxDiff: ob_odds_more_than ? +ob_odds_more_than : 0,
|
|
|
+ imRebateRatio: im_return_ratio ? +im_return_ratio : 0,
|
|
|
+ imRebateType: im_return_type ? +im_return_type : 0,
|
|
|
+ imMaxDiff: im_odds_more_than ? +im_odds_more_than : 0,
|
|
|
+ hgRebateRatio: hg_return_ratio ? +hg_return_ratio : 0,
|
|
|
+ hgRebateType: hg_return_type ? +hg_return_type : 0,
|
|
|
+ hgMaxDiff: hg_odds_more_than ? +hg_odds_more_than : 0,
|
|
|
+ pcRebateRatio: pc_return_ratio ? +pc_return_ratio : 0,
|
|
|
+ pcRebateType: pc_return_type ? +pc_return_type : 0,
|
|
|
+ subsidyTime: qboss_jq_add_hours ? +qboss_jq_add_hours : 0,
|
|
|
+ subsidyAmount: qboss_jq_add_odds ? +qboss_jq_add_odds : 0,
|
|
|
+ subsidyRbWmAmount: qboss_gq_add_dy_odds ? +qboss_gq_add_dy_odds : 0,
|
|
|
+ subsidyRbOtAmount: qboss_gq_add_jq_odds ? +qboss_gq_add_jq_odds : 0,
|
|
|
};
|
|
|
+ Logs.outDev('syncQbossConfig', qbossSetting);
|
|
|
const settingFields = {};
|
|
|
let needUpdate = false;
|
|
|
Object.keys(qbossSetting).forEach(key => {
|