feat:完善入驻信息管理
This commit is contained in:
@ -6,6 +6,7 @@ import (
|
||||
"SciencesServer/config"
|
||||
"SciencesServer/serve/orm"
|
||||
"SciencesServer/utils"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type synchronized struct {
|
||||
@ -74,6 +75,43 @@ func initModel() {
|
||||
}
|
||||
return out
|
||||
}},
|
||||
&synchronized{iModel: model.NewSysIndustry(), iValues: func() interface{} {
|
||||
file := "./file/sys_industry.json"
|
||||
src := make([]*config2.MemoryForIndustry, 0)
|
||||
utils.LoadConfig(file, &src)
|
||||
out := make([]*model.SysIndustry, 0)
|
||||
|
||||
var id uint64 = 1
|
||||
|
||||
for _, v := range src {
|
||||
var parentID uint64 = 0
|
||||
|
||||
data := &model.SysIndustry{
|
||||
Model: model.Model{
|
||||
ID: id,
|
||||
},
|
||||
ParentID: parentID,
|
||||
Name: v.Name,
|
||||
}
|
||||
out = append(out, data)
|
||||
|
||||
if v.Children != nil && len(v.Children) > 0 {
|
||||
parentID = id
|
||||
for _, val := range v.Children {
|
||||
id++
|
||||
data = &model.SysIndustry{
|
||||
Model: model.Model{
|
||||
ID: id,
|
||||
},
|
||||
ParentID: parentID,
|
||||
Name: val.Name,
|
||||
}
|
||||
out = append(out, data)
|
||||
}
|
||||
}
|
||||
}
|
||||
return out
|
||||
}},
|
||||
// 日志管理
|
||||
&synchronized{iModel: model.NewSysLog()}, &synchronized{iModel: model.NewSysUserLoginLog()},
|
||||
// 用户管理
|
||||
@ -114,6 +152,18 @@ func initCacheMode() {
|
||||
}
|
||||
}},
|
||||
)
|
||||
function(
|
||||
&caches{iModel: model.NewSysIndustry(), iValues: func() interface{} {
|
||||
out := make([]*model.SysIndustry, 0)
|
||||
_ = model.ScanFields(model.NewSysIndustry(), &out, []string{"id", "name"})
|
||||
return out
|
||||
}, toCache: func(values interface{}) {
|
||||
out := values.([]*model.SysIndustry)
|
||||
for _, v := range out {
|
||||
config2.MemoryForIndustryInfo[fmt.Sprintf("%d", v.ID)] = v.Name
|
||||
}
|
||||
}},
|
||||
)
|
||||
}
|
||||
|
||||
func Init() {
|
||||
|
@ -4,8 +4,8 @@ package model
|
||||
type ActivityApply struct {
|
||||
Model
|
||||
Local
|
||||
MUid uint64 `gorm:"column:m_uid;type:int;default:0;comment:用户manage_uuid" json:"-"`
|
||||
Mode ActivityInstanceMode `gorm:"column:mode;type:tinyint(1);default:1;comment:活动模式" json:"mode"`
|
||||
IdentityUID uint64 `gorm:"column:identity_uid;type:int;default:0;comment:用户身份表uuid" json:"-"`
|
||||
Mode ActivityInstanceMode `gorm:"column:mode;type:tinyint(1);default:1;comment:活动模式" json:"mode"`
|
||||
ActivityInstanceBasic
|
||||
Content string `gorm:"column:title;type:text;comment:活动详情" json:"content"`
|
||||
MaxNumber int `gorm:"column:max_number;type:int(6);default:0;comment:报名限制人数,0不做限制" json:"max_number"`
|
||||
|
@ -7,23 +7,42 @@ type ManageCompany struct {
|
||||
Model
|
||||
Local
|
||||
InviterID uint64 `gorm:"column:inviter_id;type:int;default:0;comment:邀请人ID" json:"inviter_id"`
|
||||
Kind string `gorm:"column:kind;type:varchar(255);default:'';comment:类型" json:"kind"`
|
||||
Name string `gorm:"column:name;type:varchar(30);default:'';comment:名称" json:"name"`
|
||||
Code string `gorm:"column:code;type:varchar(30);default:'';comment:信用代码" json:"code"`
|
||||
Image
|
||||
Area
|
||||
Product string `gorm:"column:product;type:varchar(255);default:'';comment:产品信息" json:"product"`
|
||||
Url string `gorm:"column:url;type:varchar(255);default:'';comment:企业网站" json:"url"`
|
||||
Industry string `gorm:"column:industry;type:varchar(255);default:'';comment:行业领域" json:"industry"`
|
||||
Keyword string `gorm:"column:keyword;type:varchar(255);default:'';comment:关键词" json:"keyword"`
|
||||
License string `gorm:"column:license;type:varchar(255);default:'';comment:营业执照" json:"license"`
|
||||
Industry string `gorm:"column:industry;type:varchar(255);default:'';comment:行业领域" json:"-"`
|
||||
Keyword string `gorm:"column:keyword;type:varchar(255);default:'';comment:关键词" json:"-"`
|
||||
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
|
||||
Examine
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
type ManageCompanyKind int
|
||||
|
||||
const (
|
||||
ManageCompanyKindForMYQY ManageCompanyKind = iota + 1
|
||||
)
|
||||
|
||||
func (m *ManageCompany) TableName() string {
|
||||
return "manage_company"
|
||||
}
|
||||
|
||||
func (m *ManageCompany) GetKindAttribute() []int {
|
||||
out := make([]int, 0)
|
||||
_ = utils.FromJSON(m.Industry, &out)
|
||||
return out
|
||||
}
|
||||
|
||||
func (m *ManageCompany) SetKindAttribute(value []int) {
|
||||
m.Industry = utils.AnyToJSON(value)
|
||||
}
|
||||
|
||||
func (m *ManageCompany) GetIndustryAttribute() []string {
|
||||
out := make([]string, 0)
|
||||
_ = utils.FromJSON(m.Industry, &out)
|
||||
|
@ -1,9 +1,11 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/serve/orm"
|
||||
"SciencesServer/serve/orm/logic"
|
||||
"SciencesServer/utils"
|
||||
"fmt"
|
||||
"gorm.io/gorm"
|
||||
"strings"
|
||||
"testing"
|
||||
@ -77,6 +79,7 @@ func filter(src string) string {
|
||||
}
|
||||
|
||||
func TestRecoveryPatent(t *testing.T) {
|
||||
return
|
||||
src := make([]*PPatent, 0)
|
||||
sqlite := sqlite()
|
||||
|
||||
@ -142,3 +145,50 @@ func TestRecoveryPatent(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestA(t *testing.T) {
|
||||
return
|
||||
mysql := mysql()
|
||||
|
||||
file := "../../../file/sys_industry.json"
|
||||
src := make([]*config.MemoryForIndustry, 0)
|
||||
|
||||
utils.LoadConfig(file, &src)
|
||||
|
||||
out := make([]*SysIndustry, 0)
|
||||
|
||||
var id uint64 = 1
|
||||
|
||||
for _, v := range src {
|
||||
var parentID uint64 = 0
|
||||
|
||||
data := &SysIndustry{
|
||||
Model: Model{
|
||||
ID: id,
|
||||
},
|
||||
ParentID: parentID,
|
||||
Name: v.Name,
|
||||
}
|
||||
out = append(out, data)
|
||||
|
||||
if v.Children != nil && len(v.Children) > 0 {
|
||||
parentID = id
|
||||
for _, val := range v.Children {
|
||||
id++
|
||||
data = &SysIndustry{
|
||||
Model: Model{
|
||||
ID: id,
|
||||
},
|
||||
ParentID: parentID,
|
||||
Name: val.Name,
|
||||
}
|
||||
out = append(out, data)
|
||||
}
|
||||
}
|
||||
|
||||
id++
|
||||
}
|
||||
fmt.Println(utils.AnyToJSON(out))
|
||||
err := mysql.Table(NewSysIndustry().TableName()).Create(out).Error
|
||||
t.Log(err)
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ package model
|
||||
type SysIndustry struct {
|
||||
Model
|
||||
ParentID uint64 `gorm:"column:parent_id;type:int;default:0;comment:父级ID" json:"-"`
|
||||
Code string `gorm:"column:code;type:varchar(30);default:'';comment:编号" json:"code"`
|
||||
Name string `gorm:"column:name;type:varchar(30);default:'';comment:行业名称" json:"name"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
|
18
app/common/model/technology_prodcut_visit.go
Normal file
18
app/common/model/technology_prodcut_visit.go
Normal file
@ -0,0 +1,18 @@
|
||||
package model
|
||||
|
||||
// TechnologyProductVisit 技术产品访问数据模型
|
||||
type TechnologyProductVisit struct {
|
||||
Model
|
||||
ProductID uint64 `gorm:"column:product_id;type:int(11);default:0;comment:科技产品ID" json:"product_id"`
|
||||
CompanyID uint64 `gorm:"column:company_id;type:int(11);default:0;comment:公司ID" json:"company_id"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
func (m *TechnologyProductVisit) TableName() string {
|
||||
return "technology_product_visit"
|
||||
}
|
||||
|
||||
func NewTechnologyProductVisit() *TechnologyProductVisit {
|
||||
return &TechnologyProductVisit{}
|
||||
}
|
Reference in New Issue
Block a user