admin_user_dto.go
1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package dto
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
"time"
)
type AdminUserDto struct {
// 用户基础数据id
UserId int `json:"userId,omitempty"`
// 用工编号
UserCode string `json:"userCode"`
//姓名
UserName string `json:"userName"`
// 账号
Phone string `json:"phone"`
// 用户关联的组织
DepartmentName string `json:"departmentName"`
// 账号状态 1:正常 2.禁用 3:注销
EnableStatus int `json:"enableStatus,omitempty"`
// 推荐人
Referer string `json:"referer"`
// 创建时间
RegistrationDate string `json:"registrationDate,omitempty"`
// 最后登录时间
LastLogIn string `json:"lastLogIn"`
}
func NewAdminUserDto(v allied_creation_user.UserDetail) AdminUserDto {
item := AdminUserDto{
UserCode: v.UserCode,
UserId: v.UserId,
Phone: v.UserInfo.Phone,
DepartmentName: v.Department.DepartmentName,
EnableStatus: v.EnableStatus,
UserName: v.UserInfo.UserName,
RegistrationDate: v.CreatedAt.Format("2006-01-02"),
LastLogIn: "",
}
if v.Favorite.LastLogInAt > 0 {
item.LastLogIn = time.Unix(v.Favorite.LastLogInAt, 0).Format("2006-01-02 15:04:05")
}
return item
}