feat:完善信息
This commit is contained in:
12
app/common/model/sys_industry.go
Normal file
12
app/common/model/sys_industry.go
Normal file
@ -0,0 +1,12 @@
|
||||
package model
|
||||
|
||||
type SysIndustry struct {
|
||||
}
|
||||
|
||||
func (*SysIndustry) TableName() string {
|
||||
return "sys_industry"
|
||||
}
|
||||
|
||||
func NewSysIndustry() *SysIndustry {
|
||||
return &SysIndustry{}
|
||||
}
|
@ -1,69 +1,25 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"SciencesServer/utils"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type SysTenant struct {
|
||||
Model
|
||||
ParentID uint64 `gorm:"column:parent_id;type:int;default:0;comment:父级ID" json:"-"`
|
||||
Key string `gorm:"column:key;type:varchar(100);default:null;comment:租户/租户客户标识" json:"key"`
|
||||
Image
|
||||
Name string `gorm:"column:name;type:varchar(30);default:null;comment:租户名称/租户客户名称" json:"name"`
|
||||
Config string `gorm:"column:config;type:text;comment:租户/租户客户配置信息" json:"-"`
|
||||
Deadline time.Time `gorm:"column:deadline;type:datetime;default:null;comment:租户/租户客户协议截止时间" json:"deadline"`
|
||||
Status SysTenantStatus `gorm:"column:status;type:tinyint(1);default:1;comment:租户/租户客户状态" json:"status"`
|
||||
Remark string `gorm:"column:remark;type:varchar(255);default:null;comment:租户/租户客户备注" json:"remark"`
|
||||
Name string `gorm:"column:name;type:varchar(30);default:null;comment:名称" json:"name"`
|
||||
Code string `gorm:"column:code;type:varchar(30);default:null;comment:信用代码" json:"code"`
|
||||
Images
|
||||
Area
|
||||
Position string `gorm:"column:position;type:varchar(255);default:null;comment:坐标" json:"-"`
|
||||
Industry uint64 `gorm:"column:industry;type:int(11);default:0;comment:所属领域" json:"industry"`
|
||||
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
|
||||
Config string `gorm:"column:config;type:varchar(255);default:null;comment:配置信息" json:"-"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
type SysTenantConfig struct {
|
||||
MaxDevices int `json:"max_devices"` // 最大可连接设备数
|
||||
MaxCustomer int `json:"max_customer"` // 最大可拥有的客户数
|
||||
Protocol uint `json:"protocol"` // 支持的协议模式
|
||||
}
|
||||
|
||||
type SysTenantStatus int
|
||||
|
||||
const (
|
||||
// SysTenantStatusForNormal 正常
|
||||
SysTenantStatusForNormal SysTenantStatus = iota + 1
|
||||
// SysTenantStatusForWellExpire 协议将到期
|
||||
SysTenantStatusForWellExpire
|
||||
// SysTenantStatusForExpired 协议已过期
|
||||
SysTenantStatusForExpired
|
||||
// SysTenantStatusForDisable 已禁用
|
||||
SysTenantStatusForDisable
|
||||
)
|
||||
|
||||
func (m *SysTenant) TableName() string {
|
||||
return "sys_tenant"
|
||||
}
|
||||
|
||||
func (m *SysTenant) BeforeCreate(db *gorm.DB) error {
|
||||
snowflake, _ := utils.NewSnowflake(1)
|
||||
m.Key = utils.IntToString(snowflake.GetID())
|
||||
m.CreatedAt = time.Now()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *SysTenant) ConfigInfo() *SysTenantConfig {
|
||||
config := new(SysTenantConfig)
|
||||
_ = utils.FromJSON(m.Config, config)
|
||||
return config
|
||||
}
|
||||
|
||||
func (m *SysTenant) StatusTitle() string {
|
||||
if m.Status == SysTenantStatusForDisable {
|
||||
return "禁用"
|
||||
}
|
||||
return "正常"
|
||||
}
|
||||
|
||||
func NewSysTenant() *SysTenant {
|
||||
return &SysTenant{}
|
||||
}
|
||||
|
@ -3,12 +3,12 @@ package model
|
||||
type UserTenant struct {
|
||||
Model
|
||||
ModelTenant
|
||||
UID uint64 `gorm:"column:uid;index:idx_tenant_user_uuid;type:int;default:0;comment:用户表UUID" json:"-"`
|
||||
Avatar string `gorm:"column:avatar;type:varchar(255);default:null;comment:头像" json:"avatar"`
|
||||
Name string `gorm:"column:name;type:varchar(20);default:null;comment:真实姓名" json:"name"`
|
||||
Email string `gorm:"column:email;type:varchar(50);default:null;comment:邮箱" json:"email"`
|
||||
Identity int `gorm:"column:identity;type:tinyint(3);default:0;comment:身份信息" json:"-"`
|
||||
Area
|
||||
UID uint64 `gorm:"column:uid;index:idx_tenant_user_uuid;type:int;default:0;comment:用户表UUID" json:"-"`
|
||||
Avatar string `gorm:"column:avatar;type:varchar(255);default:null;comment:头像" json:"avatar"`
|
||||
Name string `gorm:"column:name;type:varchar(20);default:null;comment:真实姓名" json:"name"`
|
||||
Email string `gorm:"column:email;type:varchar(50);default:null;comment:邮箱" json:"email"`
|
||||
Identity int `gorm:"column:identity;type:tinyint(3);default:0;comment:身份信息" json:"-"`
|
||||
Address string `gorm:"column:address;type:varchar(255);default:null;comment:详细地址" json:"address"`
|
||||
Selected UserTenantSelected `gorm:"column:selected;type:tinyint(1);default:0;comment:最后一次选中的身份状态,用于下次登陆展示" json:"-"`
|
||||
Other string `gorm:"column:other;type:varchar(255);default:null;comment:其他信息" json:"-"`
|
||||
Status UserTenantStatus `gorm:"column:status;type:tinyint(0);default:0;comment:状态" json:"-"`
|
||||
@ -28,12 +28,10 @@ const (
|
||||
type UserTenantStatus int
|
||||
|
||||
const (
|
||||
// UserTenantStatusForInit 初始化
|
||||
UserTenantStatusForInit UserTenantStatus = iota
|
||||
// UserTenantStatusForExamineRefuse 审核拒绝
|
||||
UserTenantStatusForExamineRefuse UserTenantStatus = iota
|
||||
// UserTenantStatusForExamining 审核中
|
||||
UserTenantStatusForExamining
|
||||
// UserTenantStatusForExamineRefuse 审核拒绝
|
||||
UserTenantStatusForExamineRefuse
|
||||
// UserTenantStatusForExaminePass 审核通过
|
||||
UserTenantStatusForExaminePass
|
||||
)
|
||||
|
Reference in New Issue
Block a user