Authored by htoooth

add ad

/**
* 广告联盟接口
* Created by TaoHuang on 2016/11/8.
*/
'use strict';
const service = require('../models/ads-service');
const jump = (req, res, next) => {
service.jump().catch(next);
};
module.exports = {
jump
};
... ...
/**
* sub app 3party-ad
* @author: htoooth<ht.anglenx@gmail.com>
* @date: 2016/11/08
*/
var express = require('express'),
path = require('path');
var app = express();
// set view engin
var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root
app.on('mount', function(parent) {
delete parent.locals.settings; // 不继承父 App 的设置
Object.assign(app.locals, parent.locals);
});
app.use(global.yoho.hbs({
extname: '.hbs',
defaultLayout: 'layout',
layoutsDir: doraemon,
partialsDir: [path.join(__dirname, 'views/partial')],
views: path.join(__dirname, 'views/action'),
helpers: global.yoho.helpers
}));
// router
app.use(require('./router'));
module.exports = app;
... ...
/**
* Created by TaoHuang on 2016/11/8.
*/
'use strict';
const Promise = global.Promise;
const jump = () => {
return Promise.reject();
};
module.exports = {
jump
};
... ...
/**
* router of sub app 3party-ad
* @author: htoooth<ht.anglenx@gmail.com>
* @date: 2016/11/08
*/
'use strict';
const router = require('express').Router(); // eslint-disable-line
const cRoot = './controllers';
const adsService = require(`${cRoot}/ads`); // 第三方广告平台对接
// Your controller here
router.get('/ads', adsService.jump);
module.exports = router;
... ...
... ... @@ -15,7 +15,10 @@ module.exports = app => {
app.use('/product', require('./apps/product')); // 商品相关页面
app.use(require('./apps/passport')); // 登录注册
app.use('/home', require('./apps/home')); // 会员中心
app.use('/brands', require('./apps/brands'));
app.use('/guang', require('./apps/guang'));
app.use('/brands', require('./apps/brands')); // 品牌一览
app.use('/guang', require('./apps/guang')); // 逛
app.use('/cart', require('./apps/cart'));// 购物车
// 第三方,如广告联盟
app.use('/3party', require('./apps/3party'));
};
... ...