feat:完善项目信息

This commit is contained in:
henry
2022-01-11 14:54:20 +08:00
parent 8006d57506
commit 72c2cb091d
15 changed files with 299 additions and 38 deletions

View File

@ -21,6 +21,8 @@ type synchronized struct {
}
func (this *Instance) Handle() {
fmt.Println("========================\n=== 数据开始迁移 ===\n========================")
db := this.gormDB
successCount, failureCount := 0, 0
@ -136,17 +138,16 @@ func (this *Instance) Handle() {
&synchronized{iModel: model.NewTechnologyAchievement()}, &synchronized{iModel: model.NewTechnologyDemand()},
&synchronized{iModel: model.NewTechnologyPaper()}, &synchronized{iModel: model.NewTechnologyProduct()},
&synchronized{iModel: model.NewTechnologyProject()}, &synchronized{iModel: model.NewTechnologyTopic()},
&synchronized{iModel: model.NewServiceDocking()}, &synchronized{iModel: model.NewServiceMessage()},
&synchronized{iModel: model.NewServiceDocking()},
&synchronized{iModel: model.NewServiceMessage()}, &synchronized{iModel: model.NewServiceMessageLog()},
&synchronized{iModel: model.NewServiceSolutionCase()}, &synchronized{iModel: model.NewServiceSolutionCaseKind()},
&synchronized{iModel: model.NewServiceInnovate()}, &synchronized{iModel: model.NewServiceInnovateKind()},
// 活动管理
&synchronized{iModel: model.NewActivityInstance()}, &synchronized{iModel: model.NewActivityApply()},
&synchronized{iModel: model.NewActivityExamine()}, &synchronized{iModel: model.NewActivityJoin()},
)
fmt.Println("=== 数据开始迁移 ===")
fmt.Printf("=== 成功【%d】 ===\n", successCount)
fmt.Printf("=== 失败【%d】 ===\n", failureCount)
fmt.Println("=== 数据完成迁移 ===")
fmt.Printf("========================\n=== 数据完成迁移,成功【%d】失败【%d】 ===\n========================\n",
successCount, failureCount)
}
func WithGormDBOption(db *gorm.DB) Option {

View File

@ -80,6 +80,13 @@ func (m *Model) GetEncodeID() string {
return utils.HASHIDEncode(int(m.ID))
}
func (m *ModelTenant) GetEncodeTenantID() string {
if m.TenantID <= 0 {
return ""
}
return utils.HASHIDEncode(int(m.TenantID))
}
func (m *Model) SetDatabase(database string, key ...string) {
m.Database = database + "_" + strings.Join(key, "_")
}

View File

@ -3,12 +3,13 @@ package model
// ServiceMessage 留言数据模型
type ServiceMessage struct {
Model
Name string `gorm:"column:name;type:varchar(20);default:'';comment:联系人" json:"name"`
Mobile string `gorm:"column:mobile;type:varchar(15);default:'';comment:联系方式" json:"mobile"`
Email string `gorm:"column:email;type:varchar(50);default:'';comment:邮箱" json:"email"`
Company string `gorm:"column:company;type:varchar(100);default:'';comment:公司名称" json:"company"`
Content string `gorm:"column:content;type:varchar(255);default:'';comment:联系内容" json:"content"`
Status int `gorm:"column:status;type:tinyint(1);default:0;comment:状态" json:"status"`
ModelTenant
Name string `gorm:"column:name;type:varchar(20);default:'';comment:联系" json:"name"`
Mobile string `gorm:"column:mobile;type:varchar(15);default:'';comment:联系方式" json:"mobile"`
Email string `gorm:"column:email;type:varchar(50);default:'';comment:邮箱" json:"email"`
Company string `gorm:"column:company;type:varchar(100);default:'';comment:公司名称" json:"company"`
Content string `gorm:"column:content;type:varchar(255);default:'';comment:联系内容" json:"content"`
Status ServiceMessageStatus `gorm:"column:status;type:tinyint(1);default:0;comment:状态" json:"status"`
ModelDeleted
ModelAt
}
@ -18,7 +19,7 @@ type ServiceMessageStatus int
const (
// ServiceMessageStatusForProcessing 处理中
ServiceMessageStatusForProcessing ServiceMessageStatus = iota
ServiceMessageStatusForProcessing ServiceMessageStatus = iota + 1
// ServiceMessageStatusForProcessed 已处理
ServiceMessageStatusForProcessed
)

View File

@ -0,0 +1,19 @@
package model
// ServiceMessageLog 留言数据日志模型
type ServiceMessageLog struct {
Model
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户ID" json:"-"`
MessageID uint64 `gorm:"column:message_id;type:int(11);default:0;comment:信息ID" json:"-"`
Content string `gorm:"column:content;type:varchar(255);default:'';comment:内容信息" json:"-"`
ModelDeleted
ModelAt
}
func (m *ServiceMessageLog) TableName() string {
return "service_message_log"
}
func NewServiceMessageLog() *ServiceMessageLog {
return &ServiceMessageLog{}
}

View File

@ -34,11 +34,11 @@ func (m *ServiceSolutionCaseKind) ModeTitle() string {
if m.Mode == ServiceSolutionCaseModeForSmallCompany {
return "中小型企业"
} else if m.Mode == ServiceSolutionCaseModeForBigCompany {
return "中小型企业"
return "型企业"
} else if m.Mode == ServiceSolutionCaseModeForGovernment {
return "政府单位"
} else if m.Mode == ServiceSolutionCaseModeForResearch {
return "科研机构"
}
return ""
}