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 {
|
||||
c.JSON(200, resp.ErrMsg(err.Error()))
|
||||
return
|
||||
|
||||
@@ -109,19 +109,19 @@ func NeConfigUpdate(neInfo model.NeInfo, paramName, loc string, data map[string]
|
||||
return resData, nil
|
||||
}
|
||||
|
||||
// NeConfigInstall 网元配置新增 array
|
||||
func NeConfigInstall(neInfo model.NeInfo, paramName, loc string, data map[string]any) (map[string]any, error) {
|
||||
// NeConfigAdd 网元配置新增 array
|
||||
func NeConfigAdd(neInfo model.NeInfo, paramName, loc string, data map[string]any) (map[string]any, error) {
|
||||
// 网元参数配置新增(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)
|
||||
resBytes, err := fetch.PostJSON(neUrl, data, nil)
|
||||
var resData map[string]any
|
||||
if err != nil {
|
||||
errStr := err.Error()
|
||||
logger.Warnf("NeConfigInfoAdd Post \"%s\"", neUrl)
|
||||
logger.Warnf("NeConfigAdd Post \"%s\"", neUrl)
|
||||
if strings.HasPrefix(errStr, "201") || strings.HasPrefix(errStr, "204") {
|
||||
return resData, nil
|
||||
}
|
||||
logger.Errorf("NeConfigInfoAdd %s", errStr)
|
||||
logger.Errorf("NeConfigAdd %s", errStr)
|
||||
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)
|
||||
if err != nil {
|
||||
logger.Errorf("NeConfigInfoAdd Unmarshal %s", err.Error())
|
||||
logger.Errorf("NeConfigAdd Unmarshal %s", err.Error())
|
||||
return nil, err
|
||||
}
|
||||
return resData, nil
|
||||
|
||||
Reference in New Issue
Block a user