fix
zhangqian
2023-10-30 10c65da3d2af7056f48d9301e83f53f102f76e18
conf/config.go
@@ -58,6 +58,7 @@
   Services struct {
      ApsServer string
      Serial    string
   }
   nsqConf struct {
@@ -69,6 +70,15 @@
   plc struct {
      FinishNumberTimeInterval int
      TotalNumberTimeInterval  int
      ModbusIntType            string
      SlaveId                  int
      Package                  string
      StandbyTime              int64
   }
   Prompt struct {
      SafeProduce     string `json:"safeProduce,omitempty"`
      PlcNotConnected string `json:"plcNotConnected,omitempty"`
   }
   config struct {
@@ -89,6 +99,8 @@
      //PLC
      PLC plc
      Prompt Prompt
   }
)
@@ -111,6 +123,9 @@
   if err := Viper.Unmarshal(&Conf); err != nil {
      log.Fatalf("Unmarshal err:%v", err)
   }
   if Conf.PLC.StandbyTime == 0 {
      Conf.PLC.StandbyTime = 300 //5分钟
   }
   ShowConfig()
}
@@ -128,5 +143,6 @@
   log.Printf("   System:                %+v", Conf.System)
   log.Printf("   Log:                   %+v", Conf.Log)
   log.Printf("   plc :                  %+v", Conf.PLC)
   log.Printf("   services :                  %+v", Conf.Services)
   log.Println("......................................................")
}