zs 6 months ago
parent
commit
bb66211d65

+ 7 - 8
src/controller/frame/Token.controller.ts

@@ -1,10 +1,9 @@
-import { Context, Controller, Get, Inject } from "@midwayjs/core";
-import { JwtService } from "@midwayjs/jwt";
-import assert = require("assert");
-import { get } from "lodash";
-import { RoleService } from "../../service/system/role.service";
-import { RF } from "../../response/CustomerResponse";
-
+import { Context, Controller, Get, Inject } from '@midwayjs/core';
+import { JwtService } from '@midwayjs/jwt';
+import assert = require('assert');
+import { get } from 'lodash-es';
+import { RoleService } from '../../service/system/role.service';
+import { RF } from '../../response/CustomerResponse';
 
 @Controller('/token')
 export class TokenController {
@@ -26,4 +25,4 @@ export class TokenController {
     result.role_code = role_code;
     return RF.success(result);
   }
-}
+}

+ 1 - 1
src/decorator/page.decorator.ts

@@ -1,5 +1,5 @@
 import { createRequestParamDecorator } from '@midwayjs/core';
-import { get, pick, omit } from 'lodash';
+import { get, pick, omit } from 'lodash-es';
 import { QueryMapping, QueryReset } from '../frame/QueryUtils';
 const pageKeys = ['skip', 'limit'];
 /**将query的skip和limit提取到object中返回 */

+ 1 - 1
src/entity/system/admin.entity.ts

@@ -1,6 +1,6 @@
 import { modelOptions, prop } from '@typegoose/typegoose';
 import { BaseModel } from '../../frame/BaseModel';
-import { isString } from 'lodash';
+import { isString } from 'lodash-es';
 @modelOptions({
   schemaOptions: { collection: 'admin' },
 })

+ 2 - 2
src/error/CustomerError.error.ts

@@ -1,8 +1,8 @@
 import { MidwayError } from '@midwayjs/core';
-import { get } from 'lodash';
+import { get } from 'lodash-es';
 
 export class ServiceError extends MidwayError {
-  constructor(error: Object) {
+  constructor(error: object) {
     const errcode = get(error, 'code');
     const errmsg = get(error, 'msg');
     super(errcode);

+ 1 - 1
src/filter/ServiceError.filter.ts

@@ -1,7 +1,7 @@
 import { Catch, Inject, MidwayEnvironmentService } from '@midwayjs/core';
 import { Context } from '@midwayjs/koa';
 import { ServiceError } from '../error/CustomerError.error';
-import { pick } from 'lodash';
+import { pick } from 'lodash-es';
 
 const pickList = ['errmsg', 'errcode'];
 const devList = ['name', 'stack'];

+ 1 - 1
src/frame/BaseService.ts

@@ -1,7 +1,7 @@
 import { ReturnModelType } from '@typegoose/typegoose';
 import { AnyParamConstructor } from '@typegoose/typegoose/lib/types';
 import { Application, Context } from '@midwayjs/koa';
-import { cloneDeep, get } from 'lodash';
+import { cloneDeep, get } from 'lodash-es';
 import { PageOptions, ResultOptions } from './Options';
 import { PopulateOptions } from 'mongoose';
 import { App, Inject } from '@midwayjs/core';

+ 3 - 3
src/frame/Options.ts

@@ -1,5 +1,5 @@
-import { Rule, RuleType } from "@midwayjs/validate";
-import { get } from "lodash";
+import { Rule, RuleType } from '@midwayjs/validate';
+import { get } from 'lodash-es';
 
 /**分页处理参数 */
 export interface PageOptions {
@@ -40,4 +40,4 @@ export class UPwdDTO {
   // @ApiProperty({ description: '密码' })
   @Rule(RuleType['string']().required())
   password: string = undefined;
-}
+}

+ 1 - 1
src/frame/QueryUtils.ts

@@ -1,4 +1,4 @@
-import { get } from 'lodash';
+import { get } from 'lodash-es';
 const signMappings = {
   [`^[%](.*(?=))[%]$`]: { pos: 1, deal: val => new RegExp(val) },
   [`^[@]([^=].*)`]: { pos: 1, deal: val => ({ $gt: val }) },

+ 1 - 1
src/frame/Utils.ts

@@ -1,6 +1,6 @@
 import { getModelForClass, getClass } from '@typegoose/typegoose';
 import { AnyParamConstructor } from '@typegoose/typegoose/lib/types';
-import { upperFirst } from 'lodash';
+import { upperFirst } from 'lodash-es';
 import { ServiceError } from '../error/CustomerError.error';
 import { ErrorCode } from '../error/Codes';
 /**

+ 1 - 1
src/middleware/CheckToken.middleware.ts

@@ -8,7 +8,7 @@ import {
 } from '@midwayjs/core';
 import { JwtService } from '@midwayjs/jwt';
 import { Context } from '@midwayjs/koa';
-import { get } from 'lodash';
+import { get } from 'lodash-es';
 import { LoginRecordService } from '../service/frame/LoginRecord.service';
 import { ErrorCode } from '../error/Codes';
 import { ServiceError } from '../error/CustomerError.error';

+ 1 - 1
src/service/frame/File.service.ts

@@ -1,7 +1,7 @@
 import { existsSync, lstatSync, mkdirSync, readdirSync } from 'fs';
 import { Context } from '@midwayjs/koa';
 import { dirname, extname, join, sep } from 'path';
-import { flattenDeep, get, last, head } from 'lodash';
+import { flattenDeep, get, last, head } from 'lodash-es';
 import { moveSync, removeSync } from 'fs-extra';
 import { Provide, Inject, Config } from '@midwayjs/core';
 import { mongoose } from '@typegoose/typegoose';

+ 1 - 1
src/service/frame/Init.service.ts

@@ -45,7 +45,7 @@ export class InitService {
   async initRole() {
     const num = await this.roleModel.count();
     if (num > 0) return;
-    const datas = [{ name: '管理员', code: 'admin' }];
+    const datas = [{ name: '管理员', code: 'Admin' }];
     await this.roleModel.insertMany(datas);
   }
   async initMenus() {

+ 1 - 1
src/service/frame/Login.service.ts

@@ -1,6 +1,6 @@
 import { Inject, Provide } from '@midwayjs/core';
 import { LoginType, UPwdDTO } from '../../frame/Options';
-import { get, isEqual, upperFirst } from 'lodash';
+import { get, isEqual, upperFirst } from 'lodash-es';
 import { GetModel, randomStr } from '../../frame/Utils';
 import { ServiceError } from '../../error/CustomerError.error';
 import { ErrorCode } from '../../error/Codes';

+ 1 - 1
src/service/frame/LoginRecord.service.ts

@@ -4,7 +4,7 @@ import { Config, Inject, Provide } from '@midwayjs/core';
 import { InjectEntityModel } from '@midwayjs/typegoose';
 import { Context } from '@midwayjs/koa';
 import { JwtService } from '@midwayjs/jwt';
-import { get } from 'lodash';
+import { get } from 'lodash-es';
 import * as dayjs from 'dayjs';
 import { ServiceError } from '../../error/CustomerError.error';
 import { ErrorCode } from '../../error/Codes';

+ 1 - 1
src/service/system/admin.service.ts

@@ -3,7 +3,7 @@ import { BaseService } from '../../frame/BaseService';
 import { Provide } from '@midwayjs/core';
 import { Admin } from '../../entity/system/admin.entity';
 import { InjectEntityModel } from '@midwayjs/typegoose';
-import { get } from 'lodash';
+import { get } from 'lodash-es';
 import { ServiceError } from '../../error/CustomerError.error';
 import { ErrorCode } from '../../error/Codes';
 type modelType = ReturnModelType<typeof Admin>;

+ 1 - 1
src/service/system/menus.service.ts

@@ -3,7 +3,7 @@ import { BaseService } from '../../frame/BaseService';
 import { Provide } from '@midwayjs/core';
 import { Menus } from '../../entity/system/menus.entity';
 import { InjectEntityModel } from '@midwayjs/typegoose';
-import { orderBy } from 'lodash';
+import { orderBy } from 'lodash-es';
 import { Types } from 'mongoose';
 const ObjectId = Types.ObjectId;
 type modelType = ReturnModelType<typeof Menus>;

+ 1 - 1
src/service/system/role.service.ts

@@ -3,7 +3,7 @@ import { BaseService } from '../../frame/BaseService';
 import { Inject, Provide } from '@midwayjs/core';
 import { Role } from '../../entity/system/role.entity';
 import { InjectEntityModel } from '@midwayjs/typegoose';
-import { lowerFirst, upperFirst, last, flattenDeep, uniq, get } from 'lodash';
+import { lowerFirst, upperFirst, last, flattenDeep, uniq, get } from 'lodash-es';
 import { Menus } from '../../entity/system/menus.entity';
 import { ServiceError } from '../../error/CustomerError.error';
 import { MenusService } from './menus.service';

+ 1 - 1
src/service/system/user.service.ts

@@ -3,7 +3,7 @@ import { BaseService } from '../../frame/BaseService';
 import { Provide } from '@midwayjs/core';
 import { User } from '../../entity/system/user.entity';
 import { InjectEntityModel } from '@midwayjs/typegoose';
-import { get } from 'lodash';
+import { get } from 'lodash-es';
 import { ErrorCode } from '../../error/Codes';
 import { ServiceError } from '../../error/CustomerError.error';
 type modelType = ReturnModelType<typeof User>;