feat:完善项目信息
This commit is contained in:
@ -1,80 +1 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/enterprise/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
config2 "SciencesServer/config"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type Config struct{}
|
||||
|
||||
type (
|
||||
// IndustryInfo 所属领域信息
|
||||
IndustryInfo struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
)
|
||||
|
||||
// Basic 基础配置信息
|
||||
func (c *Config) Basic() {
|
||||
|
||||
}
|
||||
|
||||
// Config 配置信息
|
||||
func (c *Config) Config() map[string]interface{} {
|
||||
return config2.SystemConfig
|
||||
}
|
||||
|
||||
// Identity 身份信息
|
||||
func (c *Config) Identity() map[int]string {
|
||||
return config.TenantUserIdentityData
|
||||
}
|
||||
|
||||
// Transaction 交易信息
|
||||
func (c *Config) Transaction() map[int]string {
|
||||
return config.TechnologyTransactionData
|
||||
}
|
||||
|
||||
// Industry 行业信息
|
||||
func (c *Config) Industry(parentID uint64) []*IndustryInfo {
|
||||
mSysIndustry := model.NewSysIndustry()
|
||||
out := make([]*model2.SysIndustry, 0)
|
||||
|
||||
err := model2.ScanFields(mSysIndustry.SysIndustry, &out, []string{"id", "name"}, &model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("parent_id", parentID),
|
||||
})
|
||||
|
||||
list := make([]*IndustryInfo, 0)
|
||||
|
||||
if err != nil {
|
||||
return list
|
||||
}
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &IndustryInfo{
|
||||
ID: fmt.Sprintf("%d", v.ID),
|
||||
Name: v.Name,
|
||||
})
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
// Research 研究领域信息
|
||||
func (c *Config) Research() {
|
||||
|
||||
}
|
||||
|
||||
// Area 区域信息
|
||||
func (c *Config) Area(key string) map[string]string {
|
||||
if key == "" {
|
||||
key = config2.DefaultChinaAreaCode
|
||||
}
|
||||
return config.MemoryForAreaInfo[key]
|
||||
}
|
||||
|
||||
func NewConfig() *Config {
|
||||
return &Config{}
|
||||
}
|
||||
|
Reference in New Issue
Block a user