maxiaoshan 5 年之前
父节点
当前提交
45615bf270
共有 2 个文件被更改,包括 19 次插入4 次删除
  1. 2 2
      src/main.go
  2. 17 2
      src/util/config.go

+ 2 - 2
src/main.go

@@ -15,8 +15,8 @@ import (
 func init() {
 	qu.ReadConfig(&util.Sysconfig) //初始化配置
 	util.InitMgoPool()             //初始化连接
-	util.InitCitys()               //初始化城市信息
-	util.InitInfoType()            //初始化公告类型
+	util.InitOther()               //
+
 	//xweb框架配置
 	xweb.Config.RecoverPanic = true
 	xweb.Config.Profiler = true

+ 17 - 2
src/util/config.go

@@ -16,6 +16,7 @@ var (
 	Province      []string               //省
 	ProvinceCitys map[string][]string    //省:[市1,市2]
 	CityDistricts map[string][]string    //市:[区1,区2]
+	BuyerClass    []string               //采购单位行业
 	//City            []string //市
 	//District        []string //区、县
 )
@@ -29,7 +30,13 @@ func InitMgoPool() {
 	Mgo.InitPool()
 }
 
-func InitCitys() {
+func InitOther() {
+	initCitys()
+	initInfoType()
+	initBuyerClass()
+}
+
+func initCitys() {
 	//map初始化
 	if ProvinceCitys == nil {
 		ProvinceCitys = make(map[string][]string)
@@ -56,7 +63,7 @@ func InitCitys() {
 	}
 }
 
-func InitInfoType() {
+func initInfoType() {
 	//map初始化
 	if InfoTypeMap == nil {
 		InfoTypeMap = make(map[string]interface{})
@@ -70,3 +77,11 @@ func InitInfoType() {
 	}
 	//qu.Debug(InfoTypeArr, InfoTypeMap)
 }
+
+func initBuyerClass() {
+	datas, _ := Mgo.Find("code_buyerclass", `{}`, `{"_id":1}`, `{}`, false, -1, -1)
+	for _, data := range *datas {
+		name := data["name"].(string)
+		BuyerClass = append(BuyerClass, name)
+	}
+}