feat: 网元状态3待机判断standby
This commit is contained in:
@@ -135,16 +135,15 @@ func (r *NeInfo) SelectNeInfoByRmuid(rmUid string) model.NeInfo {
|
||||
// SelectPage 根据条件分页查询
|
||||
//
|
||||
// bandStatus 带状态信息
|
||||
func (r *NeInfo) SelectPage(query map[string]any, bandStatus bool) map[string]any {
|
||||
data := r.neInfoRepository.SelectPage(query)
|
||||
func (r *NeInfo) SelectPage(query map[string]string, bandStatus bool) ([]model.NeInfo, int64) {
|
||||
rows, total := r.neInfoRepository.SelectByPage(query)
|
||||
|
||||
// 网元直连读取网元服务状态
|
||||
if bandStatus {
|
||||
rows := data["rows"].([]model.NeInfo)
|
||||
r.bandNeStatus(&rows)
|
||||
}
|
||||
|
||||
return data
|
||||
return rows, total
|
||||
}
|
||||
|
||||
// SelectList 查询列表
|
||||
@@ -180,23 +179,24 @@ func (r *NeInfo) bandNeStatus(arr *[]model.NeInfo) {
|
||||
if v.Status != "0" {
|
||||
v.Status = "0"
|
||||
(*arr)[i].Status = v.Status
|
||||
r.neInfoRepository.Update(v)
|
||||
r.neInfoRepository.UpdateState(v.ID, v.Status)
|
||||
}
|
||||
continue
|
||||
}
|
||||
result["online"] = true
|
||||
(*arr)[i].ServerState = result
|
||||
// 网元状态设置为在线
|
||||
if v.Status != "1" {
|
||||
// 下发网管配置信息给网元
|
||||
_, err = neFetchlink.NeConfigOMC(v)
|
||||
if err == nil {
|
||||
v.Status = "1"
|
||||
} else {
|
||||
v.Status = "2"
|
||||
}
|
||||
(*arr)[i].Status = v.Status
|
||||
r.neInfoRepository.Update(v)
|
||||
status := "1"
|
||||
if parse.Boolean(result["standby"]) {
|
||||
status = "3"
|
||||
}
|
||||
// 下发网管配置信息给网元
|
||||
if _, err = neFetchlink.NeConfigOMC(v); err != nil {
|
||||
status = "2"
|
||||
}
|
||||
(*arr)[i].Status = status
|
||||
if v.Status != status {
|
||||
r.neInfoRepository.UpdateState(v.ID, status)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user