diff --git a/shared/consts/constModules/sysConst.ts b/shared/consts/constModules/sysConst.ts index dcc5e36fb..1b265f24e 100644 --- a/shared/consts/constModules/sysConst.ts +++ b/shared/consts/constModules/sysConst.ts @@ -475,6 +475,7 @@ export const FILENAME = { DIC_AUCTION_REWARD: 'dic_zyz_auctionReward', DIC_PVP_DIFFICULTRATIO: 'dic_zyz_pvp_difficultRatio', DIC_PVP_DAILY_TASK: 'dic_zyz_pvp_dailyTask', + DIC_WHITE_IP: 'dic_pay_white_ip', } export const WAR_RELATE_TABLES = [ diff --git a/shared/pubUtils/data.ts b/shared/pubUtils/data.ts index a80677dde..30032e05c 100644 --- a/shared/pubUtils/data.ts +++ b/shared/pubUtils/data.ts @@ -94,6 +94,7 @@ import { dicExpeditionSubAttr, loadExpeditionSubAttr } from './dictionary/DicExp import { dicAuctionPool, loadAuctionReward } from './dictionary/DicAuctionReward'; import { dicGuildTrainInfo, loadGuildTrainInfo } from './dictionary/DicGuildTrainInfo'; import { dicPvpDifficultRatio, loadPvpDifficultRatio } from './dictionary/DicPvpDifficultRatio'; +import { dicWhiteIp, loadWhiteIp } from './dictionary/DicWhiteIp'; import { pick } from "underscore"; export const gameData = { @@ -237,7 +238,8 @@ export const gameData = { holiday: dicHoliday, expeditionSubAttr: dicExpeditionSubAttr, auctionPool: dicAuctionPool, - auctionTime: new Map() + auctionTime: new Map(), + whiteip: dicWhiteIp, }; // 在此提供一些原先在gamedata中提供的方法,以便更方便获取gameData数据 @@ -937,6 +939,7 @@ function loadDatas() { loadAuctionReward(); loadGuildTrainInfo(); loadPvpDifficultRatio(); + loadWhiteIp(); } // 重载dicParam diff --git a/shared/pubUtils/dictionary/DicWhiteIp.ts b/shared/pubUtils/dictionary/DicWhiteIp.ts new file mode 100644 index 000000000..e7f22192b --- /dev/null +++ b/shared/pubUtils/dictionary/DicWhiteIp.ts @@ -0,0 +1,23 @@ +// 支付回调白名单 +import {readFileAndParse, parseNumberList, parseGoodStr} from '../util' +import { FILENAME } from '../../consts' +import { RewardInter } from '../interface'; + +export interface DicWhiteIp { + // 渠道 + readonly channel: string; + // ip + readonly ip: number; +} + +export const dicWhiteIp: string[] = []; +export function loadWhiteIp() { + dicWhiteIp.splice(0, dicWhiteIp.length); + + let arr = readFileAndParse(FILENAME.DIC_WHITE_IP); + + arr.forEach(o => { + dicWhiteIp.push(o.ip); + }); + arr = undefined; +} \ No newline at end of file diff --git a/shared/resource/jsons/dic_pay_white_ip.json b/shared/resource/jsons/dic_pay_white_ip.json new file mode 100644 index 000000000..6acab89c9 --- /dev/null +++ b/shared/resource/jsons/dic_pay_white_ip.json @@ -0,0 +1,186 @@ +[ + { + "channel": "37", + "ip": "14.18.237.10" + }, + { + "channel": "37", + "ip": "14.18.237.59" + }, + { + "channel": "37", + "ip": "14.18.237.166" + }, + { + "channel": "37", + "ip": "14.18.237.168" + }, + { + "channel": "37", + "ip": "14.18.237.186" + }, + { + "channel": "37", + "ip": "14.18.237.188" + }, + { + "channel": "37", + "ip": "14.18.237.118" + }, + { + "channel": "37", + "ip": "183.60.124.218" + }, + { + "channel": "37", + "ip": "14.18.237.199" + }, + { + "channel": "37", + "ip": "14.18.237.7" + }, + { + "channel": "37", + "ip": "14.18.237.29" + }, + { + "channel": "37", + "ip": "14.18.237.28" + }, + { + "channel": "37", + "ip": "121.201.25.10" + }, + { + "channel": "37", + "ip": "121.201.25.59" + }, + { + "channel": "37", + "ip": "121.201.25.166" + }, + { + "channel": "37", + "ip": "121.201.25.168" + }, + { + "channel": "37", + "ip": "121.201.25.186" + }, + { + "channel": "37", + "ip": "121.201.25.188" + }, + { + "channel": "37", + "ip": "121.201.25.118" + }, + { + "channel": "37", + "ip": "121.201.25.199" + }, + { + "channel": "37", + "ip": "121.201.25.28" + }, + { + "channel": "37", + "ip": "121.201.25.29" + }, + { + "channel": "37", + "ip": "121.201.25.7" + }, + { + "channel": "37", + "ip": "193.112.165.10 " + }, + { + "channel": "37", + "ip": "129.204.167.106" + }, + { + "channel": "37", + "ip": "134.175.206.137" + }, + { + "channel": "37", + "ip": "106.55.68.195" + }, + { + "channel": "37", + "ip": "106.55.81.96" + }, + { + "channel": "37", + "ip": "106.55.69.50" + }, + { + "channel": "37", + "ip": "42.194.242.152" + }, + { + "channel": "37", + "ip": "42.194.234.254" + }, + { + "channel": "37", + "ip": "42.194.233.254" + }, + { + "channel": "37", + "ip": "42.194.230.180" + }, + { + "channel": "37", + "ip": "42.194.226.92" + }, + { + "channel": "37", + "ip": "221.5.32.10" + }, + { + "channel": "37", + "ip": "221.5.32.59" + }, + { + "channel": "37", + "ip": "221.5.32.166" + }, + { + "channel": "37", + "ip": "221.5.32.168" + }, + { + "channel": "37", + "ip": "221.5.32.186" + }, + { + "channel": "37", + "ip": "221.5.32.188" + }, + { + "channel": "37", + "ip": "221.5.32.118" + }, + { + "channel": "37", + "ip": "221.5.110.26" + }, + { + "channel": "37", + "ip": "221.5.32.199" + }, + { + "channel": "37", + "ip": "221.5.32.7" + }, + { + "channel": "37", + "ip": "221.5.32.29" + }, + { + "channel": "37", + "ip": "221.5.32.28" + } +] \ No newline at end of file diff --git a/web-server/app/service/Sdk.ts b/web-server/app/service/Sdk.ts index e033f71ea..054a1bcd7 100644 --- a/web-server/app/service/Sdk.ts +++ b/web-server/app/service/Sdk.ts @@ -8,6 +8,7 @@ import { pick } from 'underscore'; import { UserOrderModel } from '@db/UserOrder'; import { nowSeconds } from 'app/pubUtils/timeUtil'; import { RoleModel } from '@db/Role'; +import { gameData } from 'app/pubUtils/data'; /** * Test Service @@ -24,10 +25,14 @@ export default class Sdk extends Service { public async pay37Callback(params: PayCallback37Data) { const { ctx } = this; const { app } = ctx; + const ip = ctx.request.ip; let checkResult = ctx.service.sdk.check37Sign(params); if(!checkResult) return ctx.service.utils.resResult(PAY_37_CALLBACK_CODE.MD5_ERR, ''); - // ip校验 + + if(gameData.whiteip.indexOf(ip) == -1) { + return ctx.service.utils.resResult(PAY_37_CALLBACK_CODE.IP_LIMIT, ''); + } if(nowSeconds() - params.time > 15 * 60) { return ctx.service.utils.resResult(PAY_37_CALLBACK_CODE.TIME_IS_EXPIRED, '');