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
package dto
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
"strings"
)
type UserBaseDto struct {
// 用户基础数据id
UserBaseId int `json:"userBaseId,omitempty"`
//姓名
UserName string `json:"userName"`
// 账号
Account string `json:"account"`
// 用户关联的组织
Organizations string `json:"organizations"`
// 账号状态 1:正常 2.禁用 3:注销
Status int `json:"status,omitempty"`
// 推荐人
Referer string `json:"referer"`
// 创建时间
RegistrationDate string `json:"registrationDate,omitempty"`
// 最后登录时间
LastLogIn string `json:"lastLogIn"`
}
func (dto *UserBaseDto) LoadDto(detail allied_creation_user.UserBaseDetail) {
dto.UserBaseId = detail.UserBaseId
dto.UserName = detail.UserInfo.UserName
dto.Account = detail.UserInfo.Phone
dto.Status = detail.Status
dto.Referer = detail.Referer
dto.RegistrationDate = detail.RegistrationDate
dto.LastLogIn = detail.LastLogIn
var organizations []string
for i := range detail.UserOrg {
if len(detail.UserOrg[i].OrgName) == 0 {
continue
}
organizations = append(organizations, detail.UserOrg[i].OrgName)
}
dto.Organizations = strings.Join(organizations, ",")
}