12345678910111213141516 |
- 'use strict';
- const _ = require('lodash');
- const { BusinessError, ErrorCode } = require('naf-core').Error;
- const tenantIsUse = async ctx => {
- const _tenant = ctx.tenant;
- const res = await ctx.model.System.Tenant.findOne({ _tenant });
- if (!res) throw new BusinessError(ErrorCode.SERVICE_FAULT, '该分站未开通!');
- if (!res.is_use) throw new BusinessError(ErrorCode.SERVICE_FAULT, '该分站处于关闭状态!');
- return true;
- };
- module.exports = options => {
- return async function tenantUse(ctx, next) {
- // await this.tenantIsUse(ctx);
- await next();
- };
- };
|