outlink.js 777 Bytes
const md5 = require("md5");
module.exports = function (app) {
  app.get("/out/links/index", "outLink.OutLink", function (req, res) {
    const secretKey = 'yoho9646yoho9646';
    const url = req.query.url;
    const outLinkUrl = url.indexOf('?') > -1 ? url + '&pid=' + req.session.user.auth.pid : outLinkUrl + '&pid=' + req.session.user.auth.pid;
    const pidMd5 = md5(req.session.user.auth.pid + secretKey);
    this.$extend = {
      outLinkUrl: outLinkUrl + '&pidMd5=' + pidMd5 + '&' + new Date().getTime()
    }
  });

  app.get("/iframe/links/index", "outLink.Iframe", function (req, res) {
    const outLinkUrl = req.query.url;
    this.$extend = {
      outLinkUrl: outLinkUrl.indexOf('?') > -1 ? outLinkUrl + '&code=iframe' : outLinkUrl + '?code=iframe'
    }
  });
}