package response import ( "encoding/json" "psi/models" ) // LoginResponse 登录响应 type LoginResponse struct { ID int64 `json:"id"` // 员工ID EmployeeID string `json:"employee_id"` // 工号 Fid int64 `json:"fid"` // 父级ID AboutId string `json:"about_id"` // 租户ID Username string `json:"username"` // 用户名 Name string `json:"name"` // 姓名 Role int64 `json:"role"` // 角色 Score int64 `json:"score"` // 积分 From string `json:"from"` Token string `json:"token"` // 令牌 ExpireIn int `json:"expire_in"` // 过期时间(小时) LevelInfo *EmployeeLevelInfo `json:"level_info"` // 等级信息 } // EmployeeLevelInfo 员工等级信息 type EmployeeLevelInfo struct { Level int8 `json:"level"` // 等级 MaxNum int64 `json:"max_num"` // 最大数量 ExpireTime int64 `json:"expire_time"` // 到期时间 PayTime int64 `json:"pay_time"` // 支付时间 } // EmployeeListResponse 员工列表响应 type EmployeeListResponse struct { List []EmployeeItem `json:"list"` Total int64 `json:"total"` Page int `json:"page"` PageSize int `json:"pageSize"` } // AddEmployeeResponse 添加员工响应 type AddEmployeeResponse struct { EmployeeID string `json:"employee_id"` Username string `json:"username"` Name string `json:"name"` } // EmployeeItem 员工列表项 type EmployeeItem struct { ID int64 `json:"id"` EmployeeIDStr string `json:"employee_id"` Fid int64 `json:"fid"` // 父级ID AboutId int64 `json:"about_id"` // 租户ID Code string `json:"code"` // 机械码 Username string `json:"username"` Name string `json:"name"` Phone string `json:"phone"` Role int64 `json:"role"` Score int64 `json:"score"` Status int8 `json:"status"` From string `json:"from"` LastLoginAt int64 `json:"last_login_at"` CreatedAt int64 `json:"created_at"` ExpireTime int64 `json:"expire_time"` LevelInfo *EmployeeLevelInfo `json:"level_info"` // 等级信息 Settings models.EmployeeSettingsConfig `json:"settings"` UserType *UserTypeInfo `json:"user_type"` } type UserTypeInfo struct { ID int64 `json:"id"` Name string `json:"name"` Icon string `json:"icon"` } // ConvertEmployeeToItem 将员工模型转换为响应项 func ConvertEmployeeToItem(emp models.Employee) EmployeeItem { return EmployeeItem{ ID: emp.ID, EmployeeIDStr: emp.EmployeeIDStr, Fid: emp.Fid, AboutId: emp.AboutId, Code: emp.Code, Username: emp.Username, Name: emp.Name, Phone: emp.Phone, Role: emp.Role, Score: emp.Score, From: emp.From, Status: emp.Status, LastLoginAt: emp.LastLoginAt, CreatedAt: emp.CreatedAt, ExpireTime: emp.ExpireTime, } } // EmployeeLevelConfigResponse 员工等级配置响应 type EmployeeLevelConfigResponse struct { Level int8 `json:"level"` // 等级 MaxNum int64 `json:"max_num"` // 最大子账号数量 Price int64 `json:"price"` // 价格(单位:分) LevelName string `json:"level_name"` // 等级名称 } // UserListItem 用户列表项 type UserListItem struct { ID int64 `json:"id"` EmployeeIDStr string `json:"employee_id_str"` Username string `json:"username"` Name string `json:"name"` Role int64 `json:"role"` Status int8 `json:"status"` SplitAccountConfigId int64 `json:"split_account_config_id"` SplitAccountConfig *SplitAccountConfigInfo `json:"split_account_config,omitempty"` // 分账配置详情 AboutId int64 `json:"about_id"` // 租户ID Phone string `json:"phone"` // 手机号 From string `json:"from"` // 来源 LastLoginIp string `json:"last_login_ip"` // 最后登录IP Code string `json:"code"` // 机械码 ExpireTime int64 `json:"expire_time"` // 到期时间 } // GetUserListResponse 用户列表响应 type GetUserListResponse struct { List []UserListItem `json:"list"` Total int64 `json:"total"` Page int `json:"page"` PageSize int `json:"page_size"` } // UpdateEmployeeSplitAccountConfigResponse 更新员工分账配置响应 type UpdateEmployeeSplitAccountConfigResponse struct { ID int64 `json:"id"` EmployeeIDStr string `json:"employee_id_str"` Username string `json:"username"` Name string `json:"name"` Phone string `json:"phone"` AboutId int64 `json:"about_id"` SplitAccountConfigId int64 `json:"split_account_config_id"` Status int8 `json:"status"` UpdatedAt int64 `json:"updated_at"` } // CurrentUserResponse 当前用户信息响应(包含分账配置) type CurrentUserResponse struct { ID int64 `json:"id"` EmployeeIDStr string `json:"employee_id_str"` Username string `json:"username"` Name string `json:"name"` Phone string `json:"phone"` Role int64 `json:"role"` Fid int64 `json:"fid"` AboutId int64 `json:"about_id"` Status int8 `json:"status"` Score int64 `json:"score"` SplitAccountConfigId int64 `json:"split_account_config_id"` SplitAccountConfig *SplitAccountConfigInfo `json:"split_account_config,omitempty"` // 分账配置详情 CreatedAt int64 `json:"created_at"` UpdatedAt int64 `json:"updated_at"` } // SplitAccountConfigInfo 分账配置信息 type SplitAccountConfigInfo struct { ID int64 `json:"id"` RuleName string `json:"rule_name"` RuleValue json.RawMessage `json:"rule_value"` Status int8 `json:"status"` Description string `json:"description"` CreatedBy string `json:"created_by"` UpdatedBy string `json:"updated_by"` CreatedAt int64 `json:"created_at"` UpdatedAt int64 `json:"updated_at"` }