diff --git a/lib/core.ts b/lib/core.ts index c2363b8..02314c4 100644 --- a/lib/core.ts +++ b/lib/core.ts @@ -315,10 +315,8 @@ export class User extends Model { // @ts-ignore update_time: this.updateTime }; - if (has(this, 'auths')) { - return { ...origin, auths: get(this, 'auths', []) }; - } else if (has(this, 'groupName')) { - return { ...origin, group_name: get(this, 'groupName', '') }; + if (has(this, 'auths') || has(this, 'groupName')) { + return { ...origin, auths: get(this, 'auths', []), group_name: get(this, 'groupName', '') }; } else { return origin; } diff --git a/lib/interface.ts b/lib/interface.ts index 581791e..3fa8ee7 100644 --- a/lib/interface.ts +++ b/lib/interface.ts @@ -1,7 +1,5 @@ import Sequelize from 'sequelize'; -import { merge } from 'lodash'; import { UserAdmin, UserActive } from './enums'; -import dayjs from 'dayjs'; import { generate } from './password-hash'; import { config } from './config'; @@ -17,12 +15,10 @@ export let InfoCrudMixin = { paranoid: true, getterMethods: { createTime() { - // @ts-ignore - return dayjs(this.getDataValue('create_time')).unix() * 1000; + return new Date().getTime(); }, updateTime() { - // @ts-ignore - return dayjs(this.getDataValue('update_time')).unix() * 1000; + return new Date().getTime(); } } } @@ -105,12 +101,10 @@ export let UserInterface = { return this.getDataValue('active') === UserActive.ACTIVE; }, createTime() { - // @ts-ignore - return dayjs(this.getDataValue('create_time')).unix() * 1000; + return new Date().getTime(); }, updateTime() { - // @ts-ignore - return dayjs(this.getDataValue('update_time')).unix() * 1000; + return new Date().getTime(); } } } @@ -208,8 +202,7 @@ export let LogInterface = { updatedAt: false, getterMethods: { time() { - // @ts-ignore - return dayjs(this.getDataValue('time')).unix() * 1000; + return new Date().getTime(); } } }