Files

43 lines
980 B
Go
Raw Normal View History

2021-11-01 11:19:49 +08:00
package config
import "strings"
type (
// MemoryForIndustry 行业
MemoryForIndustry struct {
2021-12-07 16:10:12 +08:00
Code string `json:"code"`
Name string `json:"name"`
Children []*MemoryForIndustry `json:"children"`
2021-11-01 11:19:49 +08:00
}
)
var (
2021-12-16 15:35:44 +08:00
// MemoryForAreaInfo 区域信息
MemoryForAreaInfo map[string]map[string]string = make(map[string]map[string]string, 0)
2021-11-01 11:19:49 +08:00
// MemoryForIndustryInfo 行业信息
2021-12-07 16:10:12 +08:00
MemoryForIndustryInfo map[string]string = make(map[string]string, 0)
2021-11-01 11:19:49 +08:00
)
2022-01-20 09:43:26 +08:00
// Industry 行业信息
type Industry struct {
Key string `json:"key"`
Value string `json:"value"`
}
2021-11-01 11:19:49 +08:00
// GetIndustryInfo 获取行业信息
2022-01-20 09:43:26 +08:00
func GetIndustryInfo(industry, mark, sep string) *Industry {
2021-11-01 11:19:49 +08:00
obj := strings.Split(industry, mark)
out := make([]string, 0)
for _, v := range obj {
2022-01-13 10:14:02 +08:00
data, has := MemoryForIndustryInfo[v]
if !has {
2022-01-25 11:45:53 +08:00
continue
2022-01-13 10:14:02 +08:00
}
out = append(out, data)
2021-11-01 11:19:49 +08:00
}
2022-01-20 09:43:26 +08:00
//return strings.Join(out, sep)
2022-01-25 11:45:53 +08:00
return &Industry{Key: industry, Value: strings.Join(out, sep)}
2021-11-01 11:19:49 +08:00
}