Skip to content

Commit ea35da0

Browse files
committed
用户模型返回groupName字段
1 parent df39811 commit ea35da0

2 files changed

Lines changed: 7 additions & 16 deletions

File tree

lib/core.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,8 @@ export class User extends Model {
315315
// @ts-ignore
316316
update_time: this.updateTime
317317
};
318-
if (has(this, 'auths')) {
319-
return { ...origin, auths: get(this, 'auths', []) };
320-
} else if (has(this, 'groupName')) {
321-
return { ...origin, group_name: get(this, 'groupName', '') };
318+
if (has(this, 'auths') || has(this, 'groupName')) {
319+
return { ...origin, auths: get(this, 'auths', []), group_name: get(this, 'groupName', '') };
322320
} else {
323321
return origin;
324322
}

lib/interface.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import Sequelize from 'sequelize';
2-
import { merge } from 'lodash';
32
import { UserAdmin, UserActive } from './enums';
4-
import dayjs from 'dayjs';
53
import { generate } from './password-hash';
64
import { config } from './config';
75

@@ -17,12 +15,10 @@ export let InfoCrudMixin = {
1715
paranoid: true,
1816
getterMethods: {
1917
createTime() {
20-
// @ts-ignore
21-
return dayjs(this.getDataValue('create_time')).unix() * 1000;
18+
return new Date().getTime();
2219
},
2320
updateTime() {
24-
// @ts-ignore
25-
return dayjs(this.getDataValue('update_time')).unix() * 1000;
21+
return new Date().getTime();
2622
}
2723
}
2824
}
@@ -105,12 +101,10 @@ export let UserInterface = {
105101
return this.getDataValue('active') === UserActive.ACTIVE;
106102
},
107103
createTime() {
108-
// @ts-ignore
109-
return dayjs(this.getDataValue('create_time')).unix() * 1000;
104+
return new Date().getTime();
110105
},
111106
updateTime() {
112-
// @ts-ignore
113-
return dayjs(this.getDataValue('update_time')).unix() * 1000;
107+
return new Date().getTime();
114108
}
115109
}
116110
}
@@ -208,8 +202,7 @@ export let LogInterface = {
208202
updatedAt: false,
209203
getterMethods: {
210204
time() {
211-
// @ts-ignore
212-
return dayjs(this.getDataValue('time')).unix() * 1000;
205+
return new Date().getTime();
213206
}
214207
}
215208
}

0 commit comments

Comments
 (0)