|
@@ -33,10 +33,10 @@ module.exports = app => {
|
|
|
ctx.subMenu = settingMenu;
|
|
|
}
|
|
|
|
|
|
- _checkMenu(pid) {
|
|
|
+ async _checkMenu(pid) {
|
|
|
const s2bData = new S2b(this.ctx);
|
|
|
- const s2bProj = s2bData.getS2bProj(pid);
|
|
|
- this.ctx.subMenu.s2b.display = s2bProj.gxby || s2bProj.dagl;
|
|
|
+ const s2bProj = await s2bData.getS2bProj(pid);
|
|
|
+ this.ctx.subMenu.s2b.display = !!s2bProj && (!!s2bProj.gxby || !!s2bProj.dagl);
|
|
|
return s2bProj;
|
|
|
}
|
|
|
|
|
@@ -50,7 +50,7 @@ module.exports = app => {
|
|
|
try {
|
|
|
// 获取项目数据
|
|
|
const projectId = ctx.session.sessionProject.id;
|
|
|
- this._checkMenu(projectId);
|
|
|
+ await this._checkMenu(projectId);
|
|
|
const projectData = await ctx.service.project.getDataById(projectId);
|
|
|
if (projectData === null) {
|
|
|
throw '没有对应的项目数据';
|
|
@@ -95,7 +95,7 @@ module.exports = app => {
|
|
|
try {
|
|
|
// 获取项目数据
|
|
|
const projectId = ctx.session.sessionProject.id;
|
|
|
- this._checkMenu(projectId);
|
|
|
+ await this._checkMenu(projectId);
|
|
|
const projectData = await ctx.service.project.getDataById(projectId);
|
|
|
if (projectData === null) {
|
|
|
throw '没有对应的项目数据';
|
|
@@ -421,7 +421,7 @@ module.exports = app => {
|
|
|
try {
|
|
|
// 获取项目数据
|
|
|
const projectId = ctx.session.sessionProject.id;
|
|
|
- this._checkMenu(projectId);
|
|
|
+ await this._checkMenu(projectId);
|
|
|
const projectData = await ctx.service.project.getDataById(projectId);
|
|
|
if (projectData === null) {
|
|
|
throw '没有对应的项目数据';
|
|
@@ -638,7 +638,7 @@ module.exports = app => {
|
|
|
try {
|
|
|
// 获取项目数据
|
|
|
const projectId = ctx.session.sessionProject.id;
|
|
|
- this._checkMenu(projectId);
|
|
|
+ await this._checkMenu(projectId);
|
|
|
const projectData = await ctx.service.project.getDataById(projectId);
|
|
|
if (!projectData) {
|
|
|
throw '没有对应的项目数据';
|
|
@@ -679,7 +679,7 @@ module.exports = app => {
|
|
|
try {
|
|
|
// 获取项目数据
|
|
|
const projectId = ctx.session.sessionProject.id;
|
|
|
- this._checkMenu(projectId);
|
|
|
+ await this._checkMenu(projectId);
|
|
|
const projectData = await ctx.service.project.getDataById(projectId);
|
|
|
if (projectData === null) {
|
|
|
throw '没有对应的项目数据';
|
|
@@ -706,7 +706,7 @@ module.exports = app => {
|
|
|
async fun(ctx) {
|
|
|
try {
|
|
|
const projectId = ctx.session.sessionProject.id;
|
|
|
- this._checkMenu(projectId);
|
|
|
+ await this._checkMenu(projectId);
|
|
|
const projectData = await ctx.service.project.getDataById(projectId);
|
|
|
const funRela = await ctx.service.project.getFunRela(projectId);
|
|
|
if (projectData === null) {
|
|
@@ -760,7 +760,7 @@ module.exports = app => {
|
|
|
async s2b (ctx) {
|
|
|
try {
|
|
|
const projectId = ctx.session.sessionProject.id;
|
|
|
- this._checkMenu(projectId);
|
|
|
+ await this._checkMenu(projectId);
|
|
|
const projectData = await ctx.service.project.getDataById(projectId);
|
|
|
if (projectData === null) throw '没有对应的项目数据';
|
|
|
if (ctx.session.sessionUser.is_admin === 0) throw '没有访问权限';
|