Authored by 陈峰

Merge branch 'feature/platform-admin' into 'master'

Feature/platform admin



See merge request !5
... ... @@ -232,7 +232,7 @@ const activity = {
cols: [
{
caption: '文章ID',
type: 'string'
type: 'number'
},
{
caption: '赞数',
... ...
... ... @@ -110,7 +110,7 @@ const userController = {
let exportFile = excelExport.execute(conf);
res.setHeader('Content-Type', 'application/vnd.openxmlformats');
res.setHeader('Content-Disposition', 'attachment; filename=articleList.xlsx');
res.setHeader('Content-Disposition', 'attachment; filename=userList.xlsx');
res.end(exportFile, 'binary');
})
.catch(next);
... ...
... ... @@ -8,8 +8,8 @@
<title>YOHO!Activity Admin</title>
{{#if devEnv}}
<link rel="stylesheet" media="all" href="//{{devHost}}:5001/common.css?t={{startTime}}">
<link rel="stylesheet" media="all" href="//{{devHost}}:5001/{{module}}.{{page}}.css?t={{startTime}}">
<link rel="stylesheet" media="all" href="//{{devHost}}:5001/css/common.css?t={{startTime}}">
<link rel="stylesheet" media="all" href="//{{devHost}}:5001/css/{{module}}.{{page}}.css?t={{startTime}}">
{{^}}
<link rel="stylesheet" media="all" href="/yoho-activity-platform/{{version}}/css/common.css?t={{startTime}}">
<link rel="stylesheet" media="all" href="/yoho-activity-platform/{{version}}/css/{{module}}.{{page}}.css?t={{startTime}}">
... ... @@ -47,7 +47,7 @@
</div>
{{#if devEnv}}
<script src="//{{devHost}}:5001/libs.js"></script>
<script src="//{{devHost}}:5001/{{module}}.{{page}}.js"></script>
<script src="//{{devHost}}:5001/js/{{module}}.{{page}}.js"></script>
{{^}}
<script src="/yoho-activity-platform/{{version}}/libs.js?t={{startTime}}"></script>
<script src="/yoho-activity-platform/{{version}}/js/{{module}}.{{page}}.js?t={{startTime}}"></script>
... ...
... ... @@ -74,8 +74,8 @@ const article = {
res.json({
code: 200,
data: list,
pageNo,
pageSize,
pageNo: +pageNo,
pageSize: +pageSize,
totalCount,
totalPage: Math.ceil(totalCount / pageSize),
message: GET_SUCCESS
... ...
... ... @@ -28,6 +28,7 @@ const userController = {
// 用户ID
_.set(req.session, 'user.id', user.id);
_.set(req.session, 'user.phone', user.user_phone);
res.json({
code: 200,
... ... @@ -55,6 +56,7 @@ const userController = {
// 用户ID
_.set(req.session, 'user.id', id);
_.set(req.session, 'user.phone', mobile);
res.json({
code: 200,
... ...
... ... @@ -88,7 +88,8 @@ if (isProduction) {
'http://ad.yoho.cn',
'https://ad.yoho.cn',
'http://feature.yoho.cn',
'https://feature.yoho.cn'
'https://feature.yoho.cn',
'https://huodong.yoho.cn'
],
memcache: {
master: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'],
... ...
... ... @@ -6,9 +6,11 @@
'use strict';
const _ = require('lodash');
const UserModel = require('../models/user');
module.exports = (req, res, next) => {
const userId = _.get(req.session, 'user.id', 0);
const userPhone = _.get(req.session, 'user.phone');
if (!userId) {
if (req.xhr) {
... ... @@ -21,5 +23,16 @@ module.exports = (req, res, next) => {
}
}
next();
req.ctx(UserModel).isUserExisted(userPhone)
.then(result => {
if (!result.length) {
return res.json({
code: 403,
message: '抱歉,您暂未验证'
});
}
next();
})
.catch(next);
};
... ...
/**
* 用户鉴权model
* @author: leo <qi.li@yoho.cn>
* @date: 28/06/2017
*/
const mysqlCli = global.yoho.utils.mysqlCli;
const TABLE_USER = 'user';
class UserModel extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
/**
* 判断用户是否存在
* @param phone
* @returns {*}
*/
isUserExisted(phone) {
return mysqlCli.query(
`select * from ${TABLE_USER} where user_phone = :phone;`, {
phone
}
);
}
}
module.exports = UserModel;
... ...
... ... @@ -8,7 +8,7 @@
<title>YOHO!活动平台</title>
{{#if devEnv}}
<link rel="stylesheet" media="all" href="//{{devHost}}:5001/common.css?t={{startTime}}">
<link rel="stylesheet" media="all" href="//{{devHost}}:5001/css/common.css?t={{startTime}}">
{{^}}
<link rel="stylesheet" media="all"
href="/yoho-activity-platform/{{version}}/css/common.css?t={{startTime}}">
... ...
... ... @@ -8,7 +8,7 @@
<title>YOHO!活动平台</title>
{{#if devEnv}}
<link rel="stylesheet" media="all" href="//{{devHost}}:5001/common.css?t={{startTime}}">
<link rel="stylesheet" media="all" href="//{{devHost}}:5001/css/common.css?t={{startTime}}">
{{^}}
<link rel="stylesheet" media="all"
href="/yoho-activity-platform/{{version}}/css/common.css?t={{startTime}}">
... ...
... ... @@ -8,7 +8,7 @@
<title>YOHO!活动平台</title>
{{#if devEnv}}
<link rel="stylesheet" media="all" href="//{{devHost}}:5001/common.css?t={{startTime}}">
<link rel="stylesheet" media="all" href="//{{devHost}}:5001/css/common.css?t={{startTime}}">
{{^}}
<link rel="stylesheet" media="all"
href="/yoho-activity-platform/{{version}}/css/common.css?t={{startTime}}">
... ...
... ... @@ -8,8 +8,8 @@
<title>YOHO!活动平台</title>
{{#if devEnv}}
<link rel="stylesheet" media="all" href="//{{devHost}}:5001/common.css?t={{startTime}}">
<link rel="stylesheet" media="all" href="//{{devHost}}:5001/{{module}}.{{page}}.css?t={{startTime}}">
<link rel="stylesheet" media="all" href="//{{devHost}}:5001/css/common.css?t={{startTime}}">
<link rel="stylesheet" media="all" href="//{{devHost}}:5001/css/{{module}}.{{page}}.css?t={{startTime}}">
{{^}}
<link rel="stylesheet" media="all" href="/yoho-activity-platform/{{version}}/css/common.css?t={{startTime}}">
<link rel="stylesheet" media="all"
... ... @@ -109,10 +109,10 @@
</div>
{{#if devEnv}}
<script src="//{{devHost}}:5001/libs.js"></script>
<script src="//{{devHost}}:5001/{{module}}.{{page}}.js"></script>
<script src="//{{devHost}}:5001/js/{{module}}.{{page}}.js"></script>
{{^}}
<script src="/yoho-activity-platform/{{version}}/libs.js?t={{startTime}}"></script>
<script src="/yoho-activity-platform/{{version}}/js/{{module}}.{{page}}.js?t={{startTime}}"></script>
<script src="/yoho-activity-platform/{{version}}/js/{{module}}.{{page}}.js?t={{startTime}}"></script>
{{/if}}
</body>
</html>
... ...
require('admin/user.page.css');
function bind_delete_user() {
const deleteFn = function() {
const userId = $(this).data('id');
... ...
@import "user/user";
... ...
.test {
color: red;
}
... ...