feat:优化项目信息
This commit is contained in:
15
app/common/model/manage_agent.go
Normal file
15
app/common/model/manage_agent.go
Normal file
@ -0,0 +1,15 @@
|
||||
package model
|
||||
|
||||
type ManageAgent struct {
|
||||
Model
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
func (m *ManageAgent) TableName() string {
|
||||
return "manage_agent"
|
||||
}
|
||||
|
||||
func NewManageAgent() *ManageAgent {
|
||||
return &ManageAgent{}
|
||||
}
|
@ -2,7 +2,7 @@ package model
|
||||
|
||||
import "SciencesServer/utils"
|
||||
|
||||
// ManageCompany 公司企业管理
|
||||
// ManageCompany 公司企业入住信息管理
|
||||
type ManageCompany struct {
|
||||
Model
|
||||
Local
|
||||
|
@ -1,20 +0,0 @@
|
||||
package model
|
||||
|
||||
// ManageEnterprise 企业管理数据模型
|
||||
type ManageEnterprise struct {
|
||||
Model
|
||||
Title string `gorm:"column:title;type:varchar(30);default:null;comment:企业名称" json:"title"`
|
||||
Name string `gorm:"column:name;type:varchar(50);default:null;comment:企业联系人" json:"name"`
|
||||
Mobile string `gorm:"column:mobile;type:varchar(15);default:null;comment:企业联系方式" json:"mobile"`
|
||||
Area
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
func (m *ManageEnterprise) TableName() string {
|
||||
return "manage_enterprise"
|
||||
}
|
||||
|
||||
func NewManageEnterprise() *ManageEnterprise {
|
||||
return &ManageEnterprise{}
|
||||
}
|
@ -4,7 +4,7 @@ import (
|
||||
"SciencesServer/utils"
|
||||
)
|
||||
|
||||
// ManageLaboratory 实验室信息管理
|
||||
// ManageLaboratory 实验室入住信息管理
|
||||
type ManageLaboratory struct {
|
||||
Model
|
||||
Local
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"SciencesServer/utils"
|
||||
)
|
||||
|
||||
// ManageResearch 科研机构信息管理
|
||||
// ManageResearch 科研机构入住信息管理
|
||||
type ManageResearch struct {
|
||||
Model
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
|
15
app/common/model/user_agent.go
Normal file
15
app/common/model/user_agent.go
Normal file
@ -0,0 +1,15 @@
|
||||
package model
|
||||
|
||||
type UserAgent struct {
|
||||
Model
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
func (m *UserAgent) TableName() string {
|
||||
return "user_agent"
|
||||
}
|
||||
|
||||
func NewUserAgent() *UserAgent {
|
||||
return &UserAgent{}
|
||||
}
|
29
app/common/model/user_bank.go
Normal file
29
app/common/model/user_bank.go
Normal file
@ -0,0 +1,29 @@
|
||||
package model
|
||||
|
||||
// UserBank 用户银行卡数据模型
|
||||
type UserBank struct {
|
||||
Model
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
Name string `gorm:"column:name;type:varchar(30);default:null;comment:姓名" json:"name"`
|
||||
IDCard string `gorm:"column:id_card;type:varchar(18);default:null;comment:身份证号" json:"id_card"`
|
||||
BankCard string `gorm:"column:bank_card;type:varchar(18);default:null;comment:银行卡号" json:"bank_card"`
|
||||
BankName string `gorm:"column:bank_name;type:varchar(15);default:null;comment:银行名称" json:"bank_name"`
|
||||
IsDefault UserBankDefault `gorm:"column:is_default;type:tinyint(1);default:0;comment:默认使用(0:不默认,1:默认)" json:"-"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
type UserBankDefault int
|
||||
|
||||
const (
|
||||
UserBankDefaultForNot UserBankDefault = iota
|
||||
UserBankDefaultForYes
|
||||
)
|
||||
|
||||
func (m *UserBank) TableName() string {
|
||||
return m.NewTableName("user_bank")
|
||||
}
|
||||
|
||||
func NewUserBank() *UserBank {
|
||||
return &UserBank{}
|
||||
}
|
15
app/common/model/user_expert.go
Normal file
15
app/common/model/user_expert.go
Normal file
@ -0,0 +1,15 @@
|
||||
package model
|
||||
|
||||
type UserExpert struct {
|
||||
Model
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
func (m *UserExpert) TableName() string {
|
||||
return "user_expert"
|
||||
}
|
||||
|
||||
func NewUserExpert() *UserExpert {
|
||||
return &UserExpert{}
|
||||
}
|
48
app/common/model/user_identity.go
Normal file
48
app/common/model/user_identity.go
Normal file
@ -0,0 +1,48 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"SciencesServer/utils"
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
)
|
||||
|
||||
// UserIdentity 用户身份管理数据模型
|
||||
type UserIdentity struct {
|
||||
Model
|
||||
UUID uint64 `gorm:"column:uuid;uniqueIndex:idx_user_manage_uuid;type:int;default:0;comment:用户唯一UUID" json:"-"`
|
||||
UID uint64 `gorm:"column:uid;index:idx_user_manage_uid;type:int;default:0;comment:用户表UUID" json:"-"`
|
||||
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"`
|
||||
Job string `gorm:"column:job;type:varchar(50);default:null;comment:职务" json:"job"`
|
||||
FixedPhone string `gorm:"column:fixed_phone;type:varchar(20);default:null;comment:固定电话" json:"fixed_phone"`
|
||||
Address string `gorm:"column:address;type:varchar(255);default:null;comment:详细地址" json:"address"`
|
||||
Identity int `gorm:"column:identity;type:tinyint(3);default:0;comment:身份信息" json:"-"`
|
||||
IsSelected UserIdentitySelected `gorm:"column:is_selected;type:tinyint(1);default:0;comment:最后一次选中的身份信息" json:"-"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
// UserIdentitySelected 身份选中状态
|
||||
type UserIdentitySelected int
|
||||
|
||||
const (
|
||||
// UserIdentitySelectedForNo 未选中
|
||||
UserIdentitySelectedForNo UserIdentitySelected = iota
|
||||
// UserIdentitySelectedForYes 已选中
|
||||
UserIdentitySelectedForYes
|
||||
)
|
||||
|
||||
func (m *UserIdentity) TableName() string {
|
||||
return m.NewTableName("user_identity")
|
||||
}
|
||||
|
||||
func (m *UserIdentity) BeforeCreate(db *gorm.DB) error {
|
||||
snowflake, _ := utils.NewSnowflake(1)
|
||||
m.UUID = uint64(snowflake.GetID())
|
||||
m.CreatedAt = time.Now()
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewUserIdentity() *UserIdentity {
|
||||
return &UserIdentity{}
|
||||
}
|
15
app/common/model/user_laboratory.go
Normal file
15
app/common/model/user_laboratory.go
Normal file
@ -0,0 +1,15 @@
|
||||
package model
|
||||
|
||||
type UserLaboratory struct {
|
||||
Model
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
func (m *UserLaboratory) TableName() string {
|
||||
return "user_laboratory"
|
||||
}
|
||||
|
||||
func NewUserLaboratory() *UserLaboratory {
|
||||
return &UserLaboratory{}
|
||||
}
|
@ -1,124 +0,0 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/utils"
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
)
|
||||
|
||||
// UserManage 用户管理信息
|
||||
type UserManage struct {
|
||||
Model
|
||||
UUID uint64 `gorm:"column:uuid;uniqueIndex:idx_user_manage_uuid;type:int;default:0;comment:用户唯一UUID" json:"-"`
|
||||
UID uint64 `gorm:"column:uid;index:idx_user_manage_uid;type:int;default:0;comment:用户表UUID" json:"-"`
|
||||
ManageID uint64 `gorm:"column:manage_id;type:int(11);default:0;comment:信息管理ID,根据所在身份,对应不同数据表" json:"-"`
|
||||
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"`
|
||||
Job string `gorm:"column:job;type:varchar(50);default:null;comment:职务" json:"job"`
|
||||
FixedPhone string `gorm:"column:fixed_phone;type:varchar(20);default:null;comment:固定电话" json:"fixed_phone"`
|
||||
Address string `gorm:"column:address;type:varchar(255);default:null;comment:详细地址" json:"address"`
|
||||
Identity int `gorm:"column:identity;type:tinyint(3);default:0;comment:身份" json:"-"`
|
||||
IdentityInfo string `gorm:"column:identity_info;type:varchar(255);default:null;comment:身份信息" json:"-"`
|
||||
IsSelected UserManageSelected `gorm:"column:is_selected;type:tinyint(1);default:0;comment:最后一次选中的身份状态,用于下次登陆展示" json:"-"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
type IUserIdentity interface {
|
||||
Analysis(src string) interface{}
|
||||
}
|
||||
|
||||
type (
|
||||
// UserIdentityForCompany 公司信息
|
||||
UserIdentityForCompany struct {
|
||||
Industry string `json:"industry"`
|
||||
Keyword string `json:"keyword"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
// UserIdentityForExpert 专家信息
|
||||
UserIdentityForExpert struct {
|
||||
Industry string `json:"industry"`
|
||||
Keyword string `json:"keyword"`
|
||||
Research string `json:"research"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
// UserIdentityForResearch 研究机构信息
|
||||
UserIdentityForResearch struct {
|
||||
Name string `json:"name"`
|
||||
Industry string `json:"industry"`
|
||||
Keyword string `json:"keyword"`
|
||||
Research string `json:"research"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
// UserIdentityForLaboratory 实验室信息
|
||||
UserIdentityForLaboratory struct {
|
||||
Name string `json:"name"`
|
||||
Industry string `json:"industry"`
|
||||
Keyword string `json:"keyword"`
|
||||
Research string `json:"research"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
)
|
||||
|
||||
func (this *UserIdentityForCompany) Analysis(src string) interface{} {
|
||||
utils.FromJSON(src, this)
|
||||
return this
|
||||
}
|
||||
|
||||
func (this *UserIdentityForExpert) Analysis(src string) interface{} {
|
||||
utils.FromJSON(src, this)
|
||||
return this
|
||||
}
|
||||
|
||||
func (this *UserIdentityForResearch) Analysis(src string) interface{} {
|
||||
utils.FromJSON(src, this)
|
||||
return this
|
||||
}
|
||||
|
||||
func (this *UserIdentityForLaboratory) Analysis(src string) interface{} {
|
||||
utils.FromJSON(src, this)
|
||||
return this
|
||||
}
|
||||
|
||||
type UserManageSelected int
|
||||
|
||||
const (
|
||||
// UserManageSelectedForNo 未选中
|
||||
UserManageSelectedForNo UserManageSelected = iota
|
||||
// UserManageSelectedForYes 已选中
|
||||
UserManageSelectedForYes
|
||||
)
|
||||
|
||||
func (m *UserManage) TableName() string {
|
||||
return m.NewTableName("user_manage")
|
||||
}
|
||||
|
||||
func (m *UserManage) BeforeCreate(db *gorm.DB) error {
|
||||
snowflake, _ := utils.NewSnowflake(1)
|
||||
m.UUID = uint64(snowflake.GetID())
|
||||
m.CreatedAt = time.Now()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UserManage) GetIdentityInfoAttribute() interface{} {
|
||||
var manage IUserIdentity
|
||||
|
||||
switch m.Identity {
|
||||
case config.TenantUserIdentityForCompany:
|
||||
manage = new(UserIdentityForCompany)
|
||||
break
|
||||
case config.TenantUserIdentityForExpert:
|
||||
manage = new(UserIdentityForExpert)
|
||||
break
|
||||
}
|
||||
return manage.Analysis(m.IdentityInfo)
|
||||
}
|
||||
|
||||
func (m *UserManage) SetIdentityInfoAttribute(src IUserIdentity) {
|
||||
m.IdentityInfo = utils.AnyToJSON(src)
|
||||
}
|
||||
|
||||
func NewUserManage() *UserManage {
|
||||
return &UserManage{}
|
||||
}
|
15
app/common/model/user_research.go
Normal file
15
app/common/model/user_research.go
Normal file
@ -0,0 +1,15 @@
|
||||
package model
|
||||
|
||||
type UserResearch struct {
|
||||
Model
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
func (m *UserResearch) TableName() string {
|
||||
return "user_research"
|
||||
}
|
||||
|
||||
func NewUserResearch() *UserResearch {
|
||||
return &UserResearch{}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package model
|
||||
|
||||
// UserManageBank 用户银行卡管理
|
||||
type UserManageBank struct {
|
||||
Model
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
Name string `gorm:"column:name;type:varchar(30);default:null;comment:姓名" json:"name"`
|
||||
IDCard string `gorm:"column:id_card;type:varchar(18);default:null;comment:身份证号" json:"id_card"`
|
||||
BankCard string `gorm:"column:bank_card;type:varchar(18);default:null;comment:银行卡号" json:"bank_card"`
|
||||
BankName string `gorm:"column:bank_name;type:varchar(15);default:null;comment:银行名称" json:"bank_name"`
|
||||
IsDefault UserManageBankDefault `gorm:"column:is_default;type:tinyint(1);default:0;comment:默认使用(0:不默认,1:默认)" json:"-"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
type UserManageBankDefault int
|
||||
|
||||
const (
|
||||
UserManageBankDefaultForNot UserManageBankDefault = iota
|
||||
UserManageBankDefaultForYes
|
||||
)
|
||||
|
||||
func (m *UserManageBank) TableName() string {
|
||||
return m.NewTableName("user_manage_bank")
|
||||
}
|
||||
|
||||
func NewUserManageBank() *UserManageBank {
|
||||
return &UserManageBank{}
|
||||
}
|
Reference in New Issue
Block a user