/**
* 激活点击统计 controller
* @author: wsl<shuiling.wang@yoho.cn>
* @date: 2017/03/21
*/
'use strict';
const Model = require('../models/activate');
const index = (req, res, next) => {
let uid = req.user.uid;
Model.canLogin(uid).then(canLogin => {
if (canLogin === 'N') {
return next();
} else {
res.render('activate', {
module: '3party',
page: 'activate',
layout: false
});
}
}).catch(next);
};
const getList = (req, res, next) => {
let uid = req.user.uid;
Model.getList({
uid: uid,
activateTimeBegin: req.query.startTime ? req.query.startTime + ' 00:00:00' : '',
activateTimeEnd: req.query.endTime ? req.query.endTime + ' 23:59:59' : ''
}).then(result => {
res.json(result.data.list);
}).catch(next);
};
module.exports = {
index,
getList
};
... ...
/**
* 激活点击统计 models
* @author: wsl<shuiling.wang@yoho.cn>
* @date: 2017/03/21
*/
'use strict';
const unionApi = new global.yoho.ApiBase(global.yoho.config.domains.unionApi, {
name: 'union',
cache: global.yoho.cache,
useCache: false
});
const canLogin = (uid) => {
return unionApi.post('/union/ActivateUnionRest/canlogin', {
uid: uid
}).then(result => {
if (result && result.code === 200) {
return result.data.canLogin;
} else {
return Promise.reject(result);
}
});
};
const getList = (params) => {
return unionApi.post('/union/ActivateUnionRest/queryYHActivateDeviceId', params).then(result => {
if (result && result.code === 200) {
return result;
} else {
return Promise.reject(result);
}
});
};
module.exports = {
canLogin,
getList
};
... ...
... ... @@ -14,6 +14,7 @@ const auth = require(`${global.middleware}/auth`);
const ads = require(`${cRoot}/ads`); // 第三方广告平台对接
const robot = require(`${cRoot}/robot-check`); // 机器人检查
const materialController = require(`${cRoot}/material`);
const activate = require(`${cRoot}/activate`); // 激活点击统计
router.get('/ads', ads.jump);
router.get('/check', robot.index);
... ... @@ -25,4 +26,7 @@ router.get('/material/getCategory', auth, materialController.getCategory);
router.get('/material/getList', auth, materialController.getList);
router.get('/material/getRecommendlist', auth, materialController.getRecommendlist);
router.get('/activate-count', auth, activate.index);
router.get('/activate-count/getList', auth, activate.getList);
module.exports = router;
... ...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{{title}}</title>
<meta name="keywords" content="{{keywords}}">
<meta name="description" content="{{description}}"> {{#if cononicalURL}}
<link rel="cononical" href="{{cononicalURL}}" /> {{/if}}
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta http-equiv="cleartype" content="on">
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta content="telephone=no" name="format-detection" />
<meta content="email=no" name="format-detection" /> {{#dnsPrefetch.hosts}}
<link rel="dns-prefetch" href="{{this}}"> {{/dnsPrefetch.hosts}}
{{#if devEnv}}
<link rel="stylesheet" href="//{{devHost}}:5002/css/base.css">
<link rel="stylesheet" href="//{{devHost}}:5002/css/{{#if cssModule}}{{cssModule}}.css{{^}}{{module}}.css{{/if}}">
{{^}}
<link rel="stylesheet" href="//{{#isEqual cdn 'qcloud'}}qcdn.yoho.cn{{^}}cdn.yoho.cn{{/isEqual}}/yohobuy-node/{{version}}/base.css">
<link rel="stylesheet" href="//{{#isEqual cdn 'qcloud'}}qcdn.yoho.cn{{^}}cdn.yoho.cn{{/isEqual}}/yohobuy-node/{{version}}/{{#if cssModule}}{{cssModule}}.css{{^}}{{module}}.css{{/if}}">
{{/if}}
</head>
<body>
<div class="activate-count-page">
<h1><i class="logo"></i>激活点击统计列表</h1>
<div class="line">
<label for="" style="margin-left: 10px;">开始时间:</label>
<input type="date" class="sel start-time">
<label for="" style="margin-left: 10px;">结束时间:</label>
<input type="date" class="sel end-time">
<div class="query-btn">查询</div>
</div>
<div class="table-data">
</div>
</div>
{{#if devEnv}}
<script src="//{{devHost}}:5002/libs.js"></script>
<script src="//{{devHost}}:5002/{{module}}.{{page}}.js"></script>
{{^}}
<script src="//{{#isEqual cdn 'qcloud'}}qcdn.yoho.cn{{^}}cdn.yoho.cn{{/isEqual}}/yohobuy-node/{{version}}/libs.js"></script>
<script src="//{{#isEqual cdn 'qcloud'}}qcdn.yoho.cn{{^}}cdn.yoho.cn{{/isEqual}}/yohobuy-node/{{version}}/{{module}}.{{page}}.js"></script>
{{> analysis}}
{{/if}}
</body>
</html>
... ...
... ... @@ -37,7 +37,8 @@ module.exports = {
imSocket: 'ws://socket.yohobuy.com:10240',
imCs: 'http://im.yohobuy.com/api',
platformApi: 'http://172.16.6.210:8088/'
platformApi: 'http://172.16.6.210:8088/',
unionApi: 'http://172.16.6.90:8080/'
},
subDomains: {
host: '.yohobuy.com',
... ...
<table border="1" class="table">
<tr>
<th>渠道Id</th>
<th>渠道名称</th>
<th>激活IOS数</th>
<th>激活安卓数</th>
</tr>
{{#each list}}
<tr>
<td>{{unionType}}</td>
<td>{{unionName}}</td>
<td>{{idfaCount}}</td>
<td>{{imeiCount}}</td>
</tr>
{{/each}}
</table>
\ No newline at end of file
... ...
var $ = require('yoho-jquery');
var tableTmp = require('hbs/3party/activate-tbl.hbs');
var $startTime = $('.start-time');
var $endTime = $('.end-time');
function time() {
var date = new Date(),
year = date.getFullYear(),
month = (date.getMonth() + 1),
day = date.getDate();
month = month < 10 ? '0' + month : month;
day = day < 10 ? '0' + day : day;
return year + '-' + month + '-' + day;
}
function getList(params) {
$.ajax({
url: '/3party/activate-count/getList',
type: 'get',
data: params,
success: function(list) {
$('.table-data').html(tableTmp({list: list}));
}
});
}
$(function() {
var timeData = time();
$startTime.val(timeData);
$endTime.val(timeData);
getList({
startTime: timeData,
endTime: timeData
});
$('.query-btn').on('click', function() {
getList({
startTime: $startTime.val(),
endTime: $endTime.val()
});
});
});
... ...
.activate-count-page {
margin: auto;
font-family: '微软雅黑';
font-size: 14px;
.logo {
width: 171px;
height: 40px;
display: inline-block;
background-image: url(../img/sprite.3party.png);
background-position: 0px 0px;
vertical-align: middle;
margin-right: 10px;
}
input, select {
outline: none;
}
h1 {
font-size: 22px;
margin: 0 0 50px;
text-align: left;
width: 100%;
padding: 20px;
color: #a5a5a5;
box-sizing: border-box;
border-bottom: 1px solid #e2e2e2;
background: #f7f7f7;
}
/* 过滤 */
.line {
width: 90%;
margin: 20px auto;
}
.sel {
width: 173px;
vertical-align: middle;
padding: 9px;
border-radius: 4px;
box-sizing: border-box;
border: 1px solid #d6d6d6;
}
.query-btn {
border-radius: 4px;
background: #20a0ff;
padding: 10px 25px;
color: #fff;
font-size: 14px;
display: inline-block;
cursor: pointer;
vertical-align: middle;
margin-left: 20px;
}
label,
a {
vertical-align: middle;
}
/*表格*/
table {
width: 90%;
margin: 35px auto;
}
table {
table-layout: fixed;
empty-cells: show;
border-collapse: collapse;
img {
width: 80px;
}
}
td {
height: 36px;
}
.table {
border: 1px solid #d6d6d6;
color: #666;
}
.table th {
background-repeat: repeat-x;
height: 30px;
font-weight: bold;
}
.table td,
.table th {
border: 1px solid #d6d6d6;
padding: 5px;
text-align: center;
}
.table tr.alter {
background-color: #f5fafe;
}
}
\ No newline at end of file
... ...
@import "robot-check";
@import "../variables";
@import "material";
@import "activate";
\ No newline at end of file
... ...