| 12345678910111213141516171819202122232425262728293031323334 | 
							- 'use strict';
 
- /**
 
-  * 检验是否为项目管理员中间件
 
-  *
 
-  * @author CaiAoLin
 
-  * @date 2018/1/23
 
-  * @version
 
-  */
 
- module.exports = app => {
 
-     return function* projectManagerCheck(next) {
 
-         const sessionProject = this.session.sessionProject;
 
-         const sessionUser = this.session.sessionUser;
 
-         try {
 
-             if (sessionProject.userAccount === undefined) {
 
-                 throw '不存在对应项目数据';
 
-             }
 
-             // 判断当前用户是否为管理员
 
-             if (sessionUser.account !== sessionProject.userAccount) {
 
-                 throw '当前用户没有权限';
 
-             }
 
-         } catch (error) {
 
-             this.log(error);
 
-             if (this.helper.isAjax(this.request)) {
 
-                 this.ajaxErrorBody(error, '管理员权限异常');
 
-             } else {
 
-                 this.postError(error, '管理员权限异常');
 
-                 return this.redirect(this.request.headers.referer);
 
-             }
 
-         }
 
-         yield next;
 
-     };
 
- };
 
 
  |