forward.js 799 Bytes
/**
 * 连接内容返回
 * @author: xiaoxiao<xiaoxiao.hao@yoho.cn>
 * @date: 2018/01/4
 */
'use strict';

const request = require('request-promise');

const miniapp = (req, res) => {
    return request({
        baseUrl: global.yoho.config.domains.api,
        uri: 'wechat/miniapp/img-check.jpg',
        qs: req.query,
        headers: {
            'X-request-ID': req.reqID || '',
            'X-YOHO-IP': req.yoho.clientIp || '',
            'X-Forwarded-For': req.yoho.clientIp || '',
            'User-Agent': 'yoho/nodejs'
        }
    }).pipe(res); // eslint-disable-line
};

// 微信返回下载页
const download = (req, res) => {
    return res.redirect(301, `//union.yoho.cn/union/app-downloads.html?union_type=100000000010599`);
};

module.exports = {
    miniapp,
    download
};