开放接口,修复上游同步不对的问题
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m55s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m55s
This commit is contained in:
32
internal/gateway/card_status.go
Normal file
32
internal/gateway/card_status.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package gateway
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/break/junhong_cmp_fiber/pkg/constants"
|
||||
)
|
||||
|
||||
// ParseCardNetworkStatus 将 Gateway 卡状态转换为系统网络状态。
|
||||
// 只有网关明确返回“正常”才视为开机;“准备”或“待激活”不能按正常卡展示。
|
||||
func ParseCardNetworkStatus(cardStatus, extend string) (int, bool) {
|
||||
status := strings.TrimSpace(cardStatus)
|
||||
ext := strings.TrimSpace(extend)
|
||||
|
||||
switch status {
|
||||
case constants.GatewayCardStatusNormal:
|
||||
return constants.NetworkStatusOnline, true
|
||||
case constants.GatewayCardStatusStopped, constants.GatewayCardStatusReady:
|
||||
return constants.NetworkStatusOffline, true
|
||||
}
|
||||
|
||||
if ext == constants.GatewayCardExtendPendingActivation {
|
||||
return constants.NetworkStatusOffline, true
|
||||
}
|
||||
|
||||
return constants.NetworkStatusOffline, false
|
||||
}
|
||||
|
||||
// IsGatewayCardStopped 判断 Gateway 是否明确返回停机状态。
|
||||
func IsGatewayCardStopped(cardStatus string) bool {
|
||||
return strings.TrimSpace(cardStatus) == constants.GatewayCardStatusStopped
|
||||
}
|
||||
Reference in New Issue
Block a user