feat: 接口网元状态/网元列表

This commit is contained in:
TsMask
2023-12-21 20:42:50 +08:00
parent 509fdbba95
commit f5c852d801
10 changed files with 480 additions and 5 deletions

View File

@@ -20,3 +20,24 @@ type NeInfoImpl struct {
func (r *NeInfoImpl) SelectNeInfoByNeTypeAndNeID(neType, neID string) model.NeInfo {
return r.NeInfoRepository.SelectNeInfoByNeTypeAndNeID(neType, neID)
}
// SelectNeList 查询网元列表
func (r *NeInfoImpl) SelectNeList(ne model.NeInfo, bandStatus bool) []model.NeInfo {
list := r.NeInfoRepository.SelectNeList(ne)
// 网元直连读取网元服务状态
if bandStatus {
neList := &list
for i := range *neList {
v := (*neList)[i]
result, err := NeState(v)
if err != nil {
(*neList)[i].ServerState = map[string]any{}
continue
}
(*neList)[i].ServerState = result
}
}
return list
}