Skip to content

Commit b79f02b

Browse files
authored
Merge pull request #27 from TaleLin/dev
Fix known bugs
2 parents c0176f3 + ea35da0 commit b79f02b

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

lib/core.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ export class Manager {
253253
export class User extends Model {
254254
public id!: number;
255255
public username!: string;
256+
public nickname!: string;
256257
public admin!: number;
257258
public active!: number;
258259
public email!: string;
@@ -303,6 +304,7 @@ export class User extends Model {
303304
const origin = {
304305
id: this.id,
305306
username: this.username,
307+
nickname: this.nickname,
306308
admin: this.admin,
307309
active: this.active,
308310
email: this.email,
@@ -313,10 +315,8 @@ export class User extends Model {
313315
// @ts-ignore
314316
update_time: this.updateTime
315317
};
316-
if (has(this, 'auths')) {
317-
return { ...origin, auths: get(this, 'auths', []) };
318-
} else if (has(this, 'groupName')) {
319-
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', '') };
320320
} else {
321321
return origin;
322322
}

lib/interface.ts

+6-13
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
}
@@ -54,7 +50,7 @@ export let UserInterface = {
5450
comment: '头像url',
5551
get() {
5652
// @ts-ignore
57-
return this.getDataValue('avatar') ? config.getItem('siteDomain') + 'assets/' + this.getDataValue('avatar') : null;
53+
return this.getDataValue('avatar') ? config.getItem('siteDomain').replace(/\/+$/, '') + '/assets/' + this.getDataValue('avatar') : null;
5854
}
5955

6056
},
@@ -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)