fix: 网元配置新增函数命名
This commit is contained in:
@@ -335,7 +335,7 @@ func (s NeConfigController) DataAdd(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 网元直连
|
// 网元直连
|
||||||
resData, err := neFetchlink.NeConfigInstall(neInfo, body.ParamName, body.Loc, body.ParamData)
|
resData, err := neFetchlink.NeConfigAdd(neInfo, body.ParamName, body.Loc, body.ParamData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.JSON(200, resp.ErrMsg(err.Error()))
|
c.JSON(200, resp.ErrMsg(err.Error()))
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -109,19 +109,19 @@ func NeConfigUpdate(neInfo model.NeInfo, paramName, loc string, data map[string]
|
|||||||
return resData, nil
|
return resData, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NeConfigInstall 网元配置新增 array
|
// NeConfigAdd 网元配置新增 array
|
||||||
func NeConfigInstall(neInfo model.NeInfo, paramName, loc string, data map[string]any) (map[string]any, error) {
|
func NeConfigAdd(neInfo model.NeInfo, paramName, loc string, data map[string]any) (map[string]any, error) {
|
||||||
// 网元参数配置新增(array)
|
// 网元参数配置新增(array)
|
||||||
neUrl := fmt.Sprintf("http://%s:%d/api/rest/systemManagement/v1/elementType/%s/objectType/config/%s?loc=%v", neInfo.IP, neInfo.Port, strings.ToLower(neInfo.NeType), paramName, loc)
|
neUrl := fmt.Sprintf("http://%s:%d/api/rest/systemManagement/v1/elementType/%s/objectType/config/%s?loc=%v", neInfo.IP, neInfo.Port, strings.ToLower(neInfo.NeType), paramName, loc)
|
||||||
resBytes, err := fetch.PostJSON(neUrl, data, nil)
|
resBytes, err := fetch.PostJSON(neUrl, data, nil)
|
||||||
var resData map[string]any
|
var resData map[string]any
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errStr := err.Error()
|
errStr := err.Error()
|
||||||
logger.Warnf("NeConfigInfoAdd Post \"%s\"", neUrl)
|
logger.Warnf("NeConfigAdd Post \"%s\"", neUrl)
|
||||||
if strings.HasPrefix(errStr, "201") || strings.HasPrefix(errStr, "204") {
|
if strings.HasPrefix(errStr, "201") || strings.HasPrefix(errStr, "204") {
|
||||||
return resData, nil
|
return resData, nil
|
||||||
}
|
}
|
||||||
logger.Errorf("NeConfigInfoAdd %s", errStr)
|
logger.Errorf("NeConfigAdd %s", errStr)
|
||||||
return nil, fmt.Errorf("NeService Config Add API Error")
|
return nil, fmt.Errorf("NeService Config Add API Error")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ func NeConfigInstall(neInfo model.NeInfo, paramName, loc string, data map[string
|
|||||||
// 序列化结果
|
// 序列化结果
|
||||||
err = json.Unmarshal(resBytes, &resData)
|
err = json.Unmarshal(resBytes, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorf("NeConfigInfoAdd Unmarshal %s", err.Error())
|
logger.Errorf("NeConfigAdd Unmarshal %s", err.Error())
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return resData, nil
|
return resData, nil
|
||||||
|
|||||||
Reference in New Issue
Block a user