| 
									
										
										
										
											2025-04-26 13:50:26 +08:00
										 |  |  |  | package model | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | import ( | 
					
						
							|  |  |  |  | 	"admin/internal/db" | 
					
						
							| 
									
										
										
										
											2025-05-16 15:17:10 +08:00
										 |  |  |  | 	"admin/internal/model/dto" | 
					
						
							| 
									
										
										
										
											2025-04-28 15:56:04 +08:00
										 |  |  |  | 	"time" | 
					
						
							| 
									
										
										
										
											2025-04-26 13:50:26 +08:00
										 |  |  |  | ) | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | func init() { | 
					
						
							|  |  |  |  | 	db.RegisterTableModels(Account{}) | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // Account 空表,就是用来兼容资源增删改查公共操作的,实际列举账号等都是走各个项目api拉取 | 
					
						
							|  |  |  |  | type Account struct { | 
					
						
							| 
									
										
										
										
											2025-05-07 15:03:19 +08:00
										 |  |  |  | 	ProjectId       int       `gorm:"index:idx_project_id"` | 
					
						
							| 
									
										
										
										
											2025-05-10 10:18:06 +08:00
										 |  |  |  | 	ServerConfId    string    `name:"区服id" json:"serveId" choices:"GetServerConfIDChoices" where:"eq"` | 
					
						
							| 
									
										
										
										
											2025-05-05 10:30:33 +08:00
										 |  |  |  | 	Account         string    `name:"账号" json:"account" where:"eq"` | 
					
						
							| 
									
										
										
										
											2025-04-28 15:56:04 +08:00
										 |  |  |  | 	RoleIds         []string  `gorm:"type:json;serializer:json" name:"角色id列表" json:"roleIds"` | 
					
						
							|  |  |  |  | 	LatestLoginTime time.Time `name:"最近登录时间" json:"latest_login_time"` | 
					
						
							| 
									
										
										
										
											2025-05-10 10:18:06 +08:00
										 |  |  |  | 	CreatedAt       time.Time `name:"创建时间" json:"create_time"` | 
					
						
							| 
									
										
										
										
											2025-04-26 13:50:26 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | func (lm *Account) TableName() string { | 
					
						
							|  |  |  |  | 	return "account" | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | func (m *Account) GetId() int { | 
					
						
							|  |  |  |  | 	return 0 | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-05-10 10:18:06 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | func (m *Account) GetServerConfIDChoices(project *Project) []*dto.CommonDtoFieldChoice { | 
					
						
							|  |  |  |  | 	return getChoiceServers(project) | 
					
						
							|  |  |  |  | } |