ads.js
711 Bytes
/**
* 广告联盟接口
* Created by TaoHuang on 2016/11/8.
*/
'use strict';
const config = global.yoho.config;
const helpers = global.yoho.helpers;
const crypto = global.yoho.crypto;
const Fn = require('lodash/fp');
const _ = require('lodash');
const jump = (req, res) => {
let _QYH_UNION = req.query._QYH_UNION || '';
let target = req.query.target || '';
let encodeStr = Fn.pipe(decodeURIComponent, _.partial(crypto.encryption, null), encodeURIComponent);
res.cookie('_QYH_UNION', encodeStr(_QYH_UNION), {
domain: config.cookieDomain,
maxAge: 60 * 60 * 24 * 1000 // 一天
});
res.redirect(target || helpers.urlFormat(''));
};
module.exports = {
jump
};