|
@@ -3,6 +3,7 @@ import { RequestBase } from '../interface/proxy.interface';
|
|
|
import { ProxyService } from './proxy.service';
|
|
|
import { HttpServiceFactory, HttpService } from '@midwayjs/axios';
|
|
|
import { get } from 'lodash';
|
|
|
+import { ErrorCode, ServiceError } from '../error/service.error';
|
|
|
|
|
|
@Provide()
|
|
|
export class PermissionService {
|
|
@@ -16,6 +17,7 @@ export class PermissionService {
|
|
|
proxyService: ProxyService;
|
|
|
@InjectClient(HttpServiceFactory, 'default')
|
|
|
serviceAxios: HttpService;
|
|
|
+
|
|
|
|
|
|
* 检查用户权限
|
|
|
* 1.获取请求 完整的uri和method
|
|
@@ -43,7 +45,7 @@ export class PermissionService {
|
|
|
};
|
|
|
const uacResult: Array<string> = await this.toRequest(getUserApiCodeConfig);
|
|
|
if (uacResult.includes(rcResult)) return true;
|
|
|
- throw new Error('no auth');
|
|
|
+ throw new ServiceError(ErrorCode.NO_AUTH);
|
|
|
}
|
|
|
|
|
|
async toRequest(config: any) {
|