Skip to content

Instantly share code, notes, and snippets.

@hmpmarketing
Last active March 22, 2018 11:39
Show Gist options
  • Select an option

  • Save hmpmarketing/49f21635c7d3ac9d7110e70701c90444 to your computer and use it in GitHub Desktop.

Select an option

Save hmpmarketing/49f21635c7d3ac9d7110e70701c90444 to your computer and use it in GitHub Desktop.
const Promise = require('bluebird');
const mysql = require("../modules/mysql.js");
const es = require("../modules/es.js");
const cache = require("../modules/memcached.js");
const redis = require("../modules/redis.js");
const helpers = require("../modules/helpers.js");
const FpToMemcache = require("../modules/fptomemcache.js");
exports.iframe = function(req, res) {
const iplong = helpers.ip2long(req.query.H);
cache.remember('action-obj-node-'+req.query.D, 300, function() {
return mysql.MobileAction.findOne({ where: {action_id: req.query.D} });
}).then(function(action){
if(!action)return res.send('')
Promise.all([
cache.remember('network-obj-node-'+action.network_id, 1800, function() {
return mysql.Network.findOne({ where: { network_id: req.query.Q } });
}),
redis.getAsync('fp_blacklist_'+action.action_id),
redis.getAsync('isp_blacklist_'+action.action_id),
FpToMemcache.prepareTrackingUrl(helpers.createDataObject(action,network,req)),
cache.add(action.action_id+'-'+iplong, '', action.action_cookie_time == 0 ? 600 : action.action_cookie_time)
]).then(function([network, pubid_blacklist,isp_blacklist]) {
console.log(isp_blacklist);
});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment