wangchuanjin 2 miesięcy temu
rodzic
commit
812de4a856
2 zmienionych plików z 5 dodań i 12 usunięć
  1. 1 1
      openPower/config.json
  2. 4 11
      openPower/openPower.go

+ 1 - 1
openPower/config.json

@@ -22,7 +22,7 @@
 	      	"maxIdleConns": 2
 	    }
   	},
-	"products": [14,15,16,17,18,19,20,22,23,24,27,28,25,26,29,30,31,32,33,34,35,43],
+	"productSql": " where a.id>=14",
 	"redis": "session=172.20.45.129:1713",
 	"domain": "https://jybx-webtest.jydev.jianyu360.com"
 }

+ 4 - 11
openPower/openPower.go

@@ -63,9 +63,9 @@ type Config struct {
 		Main *mysqlConf
 		Base *mysqlConf
 	}
-	Products []int64
-	Redis    string
-	Domain   string
+	ProductSql string
+	Redis      string
+	Domain     string
 }
 
 type mgoConf struct {
@@ -108,21 +108,14 @@ func main() {
 		MaxIdleConns: c.Mysql.Main.MaxIdleConns,
 	}
 	MysqlMain.Init()
-	filterSpec := map[int64]bool{}
-	for _, v := range c.Products {
-		filterSpec[v] = true
-	}
 	allEntity := map[int64]Entity{}
 	allEntity[-1] = &Yxy{}
 	allEntity[-2] = &Sjgl{}
 	allT := "-2:商机管理 -1:医械通"
 	for _, v := range *MysqlMain.SelectBySql(`select a.id,c.code,c.name,a.goods_code,a.name as spec_name from base_service.base_goods_spec a
 		inner join base_service.base_goods_spec_power b on (a.id=b.spec_id)
-		inner join base_service.base_function c on (b.function_code=c.code) order by a.id`) {
+		inner join base_service.base_function c on (b.function_code=c.code)` + c.ProductSql + ` order by a.id`) {
 		id := Int64All(v["id"])
-		if !filterSpec[id] {
-			continue
-		}
 		name, _ := v["name"].(string)
 		code, _ := v["code"].(string)
 		if allEntity[id] == nil {