'use strict'; const assert = require('assert'); const _ = require('lodash'); const { ObjectId } = require('mongoose').Types; const { CrudService } = require('naf-framework-mongoose/lib/service'); const { BusinessError, ErrorCode } = require('naf-core').Error; class MenuroleService extends CrudService { constructor(ctx) { super(ctx, 'menu_role'); this.model = this.ctx.model.Menurole; this.othermodel = this.ctx.model.Otheruser; this.charmodel = this.ctx.model.Character; } //左侧菜单栏 async getMenurole(data){ const {uid} = data; const otheruser = await this.othermodel.findById(uid); const charid = otheruser.characterid; const menurole = await this.charmodel.findById(charid); const allmenu = await this.model.find({}); const viewmenu = menurole.roles; return {allmenu,viewmenu}; } } module.exports = MenuroleService;