zhangqian
2023-08-24 e6c81b3916494ef51edc21774a27402d0f16c49c
constvar/const.go
@@ -1,15 +1,33 @@
package constvar
type UserStatus int
const (
   NsqTopicScheduleTask          = "aps.%v.scheduleTask" //排程任务下发
   NsqTopicGetPlcAddress         = "aps.%v.getPlcAddress"
   NsqTopicSendPlcAddress        = "aps.%v.sendPlcAddress"
   NsqTopicProcessParamsRequest  = "aps.%v.processParams.request"
   NsqTopicProcessParamsResponse = "aps.%v.processParams.response"
)
type UserType int
type PlcStartAddressType string
const (
   UserTypeSuper   UserType = iota + 1 // 超级管理员
   UserTypePrimary                     // 主账户
   UserTypeSub                         // 子账户
   PlcStartAddressTypeFinishNumber = 1
   PlcStartAddressTypeTotalNumber  = 2
)
const (
   ApsServerHost = ""
   PlcAddressDataPath          = "datafile/"
   PlcAddressDataKeyFileName   = "plc_address_key"
   PlcAddressDataValueFileName = "plc_address_value"
)
type PlcMethod string
const (
   PlcMethodModbusTCP PlcMethod = "modbusTCP"
   PlcMethodSerial    PlcMethod = "serial"
)
func (slf PlcMethod) Valid() bool {
   return slf == PlcMethodModbusTCP || slf == PlcMethodSerial
}