import { Context } from 'egg'; module.exports = () => { return async function parmsDecode(ctx: Context, next) { let xRealIp = ctx.header['x-real-ip'] && (typeof ctx.header['x-real-ip'] == 'string'? ctx.header['x-real-ip']: ctx.header['x-real-ip'][0]); ctx.clientIp = xRealIp||ctx.request.ip; console.log('*****', ctx.clientIp); await next(); }; };