Skip to content

Commit 3e5bfce

Browse files
committed
feat: handle avatar response
1 parent 71af5b6 commit 3e5bfce

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

lib/interface.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { merge } from 'lodash';
33
import { UserAdmin, UserActive } from './enums';
44
import dayjs from 'dayjs';
55
import { generate } from './password-hash';
6+
import {config} from './config';
67

78
/**
89
* 记录信息的mixin
@@ -45,7 +46,12 @@ export let UserInterface = {
4546
avatar: {
4647
// 用户默认生成图像,为null
4748
type: Sequelize.STRING({ length: 500 }),
48-
comment: '头像url'
49+
comment: '头像url',
50+
get() {
51+
// @ts-ignore
52+
return config.getItem('siteDomain') + 'assets/' + this.getDataValue('avatar');
53+
}
54+
4955
},
5056
admin: {
5157
type: Sequelize.TINYINT,

0 commit comments

Comments
 (0)