Merge branch 'feature/platform-admin' into 'master'
Feature/platform admin See merge request !5
Showing
15 changed files
with
71 additions
and
16 deletions
@@ -110,7 +110,7 @@ const userController = { | @@ -110,7 +110,7 @@ const userController = { | ||
110 | let exportFile = excelExport.execute(conf); | 110 | let exportFile = excelExport.execute(conf); |
111 | 111 | ||
112 | res.setHeader('Content-Type', 'application/vnd.openxmlformats'); | 112 | res.setHeader('Content-Type', 'application/vnd.openxmlformats'); |
113 | - res.setHeader('Content-Disposition', 'attachment; filename=articleList.xlsx'); | 113 | + res.setHeader('Content-Disposition', 'attachment; filename=userList.xlsx'); |
114 | res.end(exportFile, 'binary'); | 114 | res.end(exportFile, 'binary'); |
115 | }) | 115 | }) |
116 | .catch(next); | 116 | .catch(next); |
@@ -8,8 +8,8 @@ | @@ -8,8 +8,8 @@ | ||
8 | <title>YOHO!Activity Admin</title> | 8 | <title>YOHO!Activity Admin</title> |
9 | 9 | ||
10 | {{#if devEnv}} | 10 | {{#if devEnv}} |
11 | - <link rel="stylesheet" media="all" href="//{{devHost}}:5001/common.css?t={{startTime}}"> | ||
12 | - <link rel="stylesheet" media="all" href="//{{devHost}}:5001/{{module}}.{{page}}.css?t={{startTime}}"> | 11 | + <link rel="stylesheet" media="all" href="//{{devHost}}:5001/css/common.css?t={{startTime}}"> |
12 | + <link rel="stylesheet" media="all" href="//{{devHost}}:5001/css/{{module}}.{{page}}.css?t={{startTime}}"> | ||
13 | {{^}} | 13 | {{^}} |
14 | <link rel="stylesheet" media="all" href="/yoho-activity-platform/{{version}}/css/common.css?t={{startTime}}"> | 14 | <link rel="stylesheet" media="all" href="/yoho-activity-platform/{{version}}/css/common.css?t={{startTime}}"> |
15 | <link rel="stylesheet" media="all" href="/yoho-activity-platform/{{version}}/css/{{module}}.{{page}}.css?t={{startTime}}"> | 15 | <link rel="stylesheet" media="all" href="/yoho-activity-platform/{{version}}/css/{{module}}.{{page}}.css?t={{startTime}}"> |
@@ -47,7 +47,7 @@ | @@ -47,7 +47,7 @@ | ||
47 | </div> | 47 | </div> |
48 | {{#if devEnv}} | 48 | {{#if devEnv}} |
49 | <script src="//{{devHost}}:5001/libs.js"></script> | 49 | <script src="//{{devHost}}:5001/libs.js"></script> |
50 | -<script src="//{{devHost}}:5001/{{module}}.{{page}}.js"></script> | 50 | +<script src="//{{devHost}}:5001/js/{{module}}.{{page}}.js"></script> |
51 | {{^}} | 51 | {{^}} |
52 | <script src="/yoho-activity-platform/{{version}}/libs.js?t={{startTime}}"></script> | 52 | <script src="/yoho-activity-platform/{{version}}/libs.js?t={{startTime}}"></script> |
53 | <script src="/yoho-activity-platform/{{version}}/js/{{module}}.{{page}}.js?t={{startTime}}"></script> | 53 | <script src="/yoho-activity-platform/{{version}}/js/{{module}}.{{page}}.js?t={{startTime}}"></script> |
@@ -74,8 +74,8 @@ const article = { | @@ -74,8 +74,8 @@ const article = { | ||
74 | res.json({ | 74 | res.json({ |
75 | code: 200, | 75 | code: 200, |
76 | data: list, | 76 | data: list, |
77 | - pageNo, | ||
78 | - pageSize, | 77 | + pageNo: +pageNo, |
78 | + pageSize: +pageSize, | ||
79 | totalCount, | 79 | totalCount, |
80 | totalPage: Math.ceil(totalCount / pageSize), | 80 | totalPage: Math.ceil(totalCount / pageSize), |
81 | message: GET_SUCCESS | 81 | message: GET_SUCCESS |
@@ -28,6 +28,7 @@ const userController = { | @@ -28,6 +28,7 @@ const userController = { | ||
28 | 28 | ||
29 | // 用户ID | 29 | // 用户ID |
30 | _.set(req.session, 'user.id', user.id); | 30 | _.set(req.session, 'user.id', user.id); |
31 | + _.set(req.session, 'user.phone', user.user_phone); | ||
31 | 32 | ||
32 | res.json({ | 33 | res.json({ |
33 | code: 200, | 34 | code: 200, |
@@ -55,6 +56,7 @@ const userController = { | @@ -55,6 +56,7 @@ const userController = { | ||
55 | 56 | ||
56 | // 用户ID | 57 | // 用户ID |
57 | _.set(req.session, 'user.id', id); | 58 | _.set(req.session, 'user.id', id); |
59 | + _.set(req.session, 'user.phone', mobile); | ||
58 | 60 | ||
59 | res.json({ | 61 | res.json({ |
60 | code: 200, | 62 | code: 200, |
@@ -88,7 +88,8 @@ if (isProduction) { | @@ -88,7 +88,8 @@ if (isProduction) { | ||
88 | 'http://ad.yoho.cn', | 88 | 'http://ad.yoho.cn', |
89 | 'https://ad.yoho.cn', | 89 | 'https://ad.yoho.cn', |
90 | 'http://feature.yoho.cn', | 90 | 'http://feature.yoho.cn', |
91 | - 'https://feature.yoho.cn' | 91 | + 'https://feature.yoho.cn', |
92 | + 'https://huodong.yoho.cn' | ||
92 | ], | 93 | ], |
93 | memcache: { | 94 | memcache: { |
94 | master: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'], | 95 | master: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'], |
@@ -6,9 +6,11 @@ | @@ -6,9 +6,11 @@ | ||
6 | 'use strict'; | 6 | 'use strict'; |
7 | 7 | ||
8 | const _ = require('lodash'); | 8 | const _ = require('lodash'); |
9 | +const UserModel = require('../models/user'); | ||
9 | 10 | ||
10 | module.exports = (req, res, next) => { | 11 | module.exports = (req, res, next) => { |
11 | const userId = _.get(req.session, 'user.id', 0); | 12 | const userId = _.get(req.session, 'user.id', 0); |
13 | + const userPhone = _.get(req.session, 'user.phone'); | ||
12 | 14 | ||
13 | if (!userId) { | 15 | if (!userId) { |
14 | if (req.xhr) { | 16 | if (req.xhr) { |
@@ -21,5 +23,16 @@ module.exports = (req, res, next) => { | @@ -21,5 +23,16 @@ module.exports = (req, res, next) => { | ||
21 | } | 23 | } |
22 | } | 24 | } |
23 | 25 | ||
24 | - next(); | 26 | + req.ctx(UserModel).isUserExisted(userPhone) |
27 | + .then(result => { | ||
28 | + if (!result.length) { | ||
29 | + return res.json({ | ||
30 | + code: 403, | ||
31 | + message: '抱歉,您暂未验证' | ||
32 | + }); | ||
33 | + } | ||
34 | + | ||
35 | + next(); | ||
36 | + }) | ||
37 | + .catch(next); | ||
25 | }; | 38 | }; |
doraemon/models/user.js
0 → 100644
1 | +/** | ||
2 | + * 用户鉴权model | ||
3 | + * @author: leo <qi.li@yoho.cn> | ||
4 | + * @date: 28/06/2017 | ||
5 | + */ | ||
6 | + | ||
7 | +const mysqlCli = global.yoho.utils.mysqlCli; | ||
8 | + | ||
9 | +const TABLE_USER = 'user'; | ||
10 | + | ||
11 | +class UserModel extends global.yoho.BaseModel { | ||
12 | + constructor(ctx) { | ||
13 | + super(ctx); | ||
14 | + } | ||
15 | + | ||
16 | + /** | ||
17 | + * 判断用户是否存在 | ||
18 | + * @param phone | ||
19 | + * @returns {*} | ||
20 | + */ | ||
21 | + isUserExisted(phone) { | ||
22 | + return mysqlCli.query( | ||
23 | + `select * from ${TABLE_USER} where user_phone = :phone;`, { | ||
24 | + phone | ||
25 | + } | ||
26 | + ); | ||
27 | + } | ||
28 | +} | ||
29 | + | ||
30 | +module.exports = UserModel; | ||
31 | + | ||
32 | + | ||
33 | + |
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | <title>YOHO!活动平台</title> | 8 | <title>YOHO!活动平台</title> |
9 | 9 | ||
10 | {{#if devEnv}} | 10 | {{#if devEnv}} |
11 | - <link rel="stylesheet" media="all" href="//{{devHost}}:5001/common.css?t={{startTime}}"> | 11 | + <link rel="stylesheet" media="all" href="//{{devHost}}:5001/css/common.css?t={{startTime}}"> |
12 | {{^}} | 12 | {{^}} |
13 | <link rel="stylesheet" media="all" | 13 | <link rel="stylesheet" media="all" |
14 | href="/yoho-activity-platform/{{version}}/css/common.css?t={{startTime}}"> | 14 | href="/yoho-activity-platform/{{version}}/css/common.css?t={{startTime}}"> |
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | <title>YOHO!活动平台</title> | 8 | <title>YOHO!活动平台</title> |
9 | 9 | ||
10 | {{#if devEnv}} | 10 | {{#if devEnv}} |
11 | - <link rel="stylesheet" media="all" href="//{{devHost}}:5001/common.css?t={{startTime}}"> | 11 | + <link rel="stylesheet" media="all" href="//{{devHost}}:5001/css/common.css?t={{startTime}}"> |
12 | {{^}} | 12 | {{^}} |
13 | <link rel="stylesheet" media="all" | 13 | <link rel="stylesheet" media="all" |
14 | href="/yoho-activity-platform/{{version}}/css/common.css?t={{startTime}}"> | 14 | href="/yoho-activity-platform/{{version}}/css/common.css?t={{startTime}}"> |
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | <title>YOHO!活动平台</title> | 8 | <title>YOHO!活动平台</title> |
9 | 9 | ||
10 | {{#if devEnv}} | 10 | {{#if devEnv}} |
11 | - <link rel="stylesheet" media="all" href="//{{devHost}}:5001/common.css?t={{startTime}}"> | 11 | + <link rel="stylesheet" media="all" href="//{{devHost}}:5001/css/common.css?t={{startTime}}"> |
12 | {{^}} | 12 | {{^}} |
13 | <link rel="stylesheet" media="all" | 13 | <link rel="stylesheet" media="all" |
14 | href="/yoho-activity-platform/{{version}}/css/common.css?t={{startTime}}"> | 14 | href="/yoho-activity-platform/{{version}}/css/common.css?t={{startTime}}"> |
@@ -8,8 +8,8 @@ | @@ -8,8 +8,8 @@ | ||
8 | <title>YOHO!活动平台</title> | 8 | <title>YOHO!活动平台</title> |
9 | 9 | ||
10 | {{#if devEnv}} | 10 | {{#if devEnv}} |
11 | - <link rel="stylesheet" media="all" href="//{{devHost}}:5001/common.css?t={{startTime}}"> | ||
12 | - <link rel="stylesheet" media="all" href="//{{devHost}}:5001/{{module}}.{{page}}.css?t={{startTime}}"> | 11 | + <link rel="stylesheet" media="all" href="//{{devHost}}:5001/css/common.css?t={{startTime}}"> |
12 | + <link rel="stylesheet" media="all" href="//{{devHost}}:5001/css/{{module}}.{{page}}.css?t={{startTime}}"> | ||
13 | {{^}} | 13 | {{^}} |
14 | <link rel="stylesheet" media="all" href="/yoho-activity-platform/{{version}}/css/common.css?t={{startTime}}"> | 14 | <link rel="stylesheet" media="all" href="/yoho-activity-platform/{{version}}/css/common.css?t={{startTime}}"> |
15 | <link rel="stylesheet" media="all" | 15 | <link rel="stylesheet" media="all" |
@@ -109,10 +109,10 @@ | @@ -109,10 +109,10 @@ | ||
109 | </div> | 109 | </div> |
110 | {{#if devEnv}} | 110 | {{#if devEnv}} |
111 | <script src="//{{devHost}}:5001/libs.js"></script> | 111 | <script src="//{{devHost}}:5001/libs.js"></script> |
112 | -<script src="//{{devHost}}:5001/{{module}}.{{page}}.js"></script> | 112 | +<script src="//{{devHost}}:5001/js/{{module}}.{{page}}.js"></script> |
113 | {{^}} | 113 | {{^}} |
114 | <script src="/yoho-activity-platform/{{version}}/libs.js?t={{startTime}}"></script> | 114 | <script src="/yoho-activity-platform/{{version}}/libs.js?t={{startTime}}"></script> |
115 | -<script src="/yoho-activity-platform/{{version}}/js/{{module}}.{{page}}.js?t={{startTime}}"></script> | 115 | +<script src="/yoho-activity-platform/{{version}}/js/{{module}}.{{page}}.js?t={{startTime}}"></script> |
116 | {{/if}} | 116 | {{/if}} |
117 | </body> | 117 | </body> |
118 | </html> | 118 | </html> |
public/scss/admin/user.page.css
0 → 100644
1 | +@import "user/user"; |
public/scss/admin/user/_user.css
0 → 100644
-
Please register or login to post a comment