fix: UDM导入文件路径缺失

This commit is contained in:
TsMask
2023-09-13 12:59:33 +08:00
parent 0c7de5fac9
commit 757f2f09a8

View File

@@ -527,7 +527,7 @@ func (s *UdmUserApi) UdmAuthUserImport(w http.ResponseWriter, r *http.Request) {
} }
// 文件名 // 文件名
fileName := fmt.Sprintf("OMC_AUTH_USER_IMPORT_%s_%s", neId, fileHeader.Filename) fileName := fmt.Sprintf("OMC_AUTH_USER_IMPORT_%s_%d_%s", neId, time.Now().UnixMilli(), fileHeader.Filename)
filePath := fmt.Sprintf("%s/upload/mml/%s", conf.Get("ne.omcdir"), fileName) filePath := fmt.Sprintf("%s/upload/mml/%s", conf.Get("ne.omcdir"), fileName)
dstPath := conf.Get("mml.upload").(string) dstPath := conf.Get("mml.upload").(string)
// 输出保存文件 // 输出保存文件
@@ -544,7 +544,7 @@ func (s *UdmUserApi) UdmAuthUserImport(w http.ResponseWriter, r *http.Request) {
return return
} }
msg := fmt.Sprintf("import authdat:path=%s", fmt.Sprintf("%s%s", dstPath, fileName)) msg := fmt.Sprintf("import authdat:path=%s", fmt.Sprintf("%s/%s", dstPath, fileName))
// 发送MML // 发送MML
data, err := mmlclient.MMLSendMsgToString(neInfo.Ip, msg) data, err := mmlclient.MMLSendMsgToString(neInfo.Ip, msg)
@@ -1052,7 +1052,7 @@ func (s *UdmUserApi) UdmSubUserImport(w http.ResponseWriter, r *http.Request) {
} }
// 文件名 // 文件名
fileName := fmt.Sprintf("OMC_SUB_USER_IMPORT_%s_%s", neId, fileHeader.Filename) fileName := fmt.Sprintf("OMC_SUB_USER_IMPORT_%s_%d_%s", neId, time.Now().UnixMilli(), fileHeader.Filename)
filePath := fmt.Sprintf("%s/upload/mml/%s", conf.Get("ne.omcdir"), fileName) filePath := fmt.Sprintf("%s/upload/mml/%s", conf.Get("ne.omcdir"), fileName)
dstPath := conf.Get("mml.upload").(string) dstPath := conf.Get("mml.upload").(string)
// 输出保存文件 // 输出保存文件
@@ -1069,7 +1069,7 @@ func (s *UdmUserApi) UdmSubUserImport(w http.ResponseWriter, r *http.Request) {
return return
} }
msg := fmt.Sprintf("import udmuser:path=%s", fmt.Sprintf("%s%s", dstPath, fileName)) msg := fmt.Sprintf("import udmuser:path=%s", fmt.Sprintf("%s/%s", dstPath, fileName))
// 发送MML // 发送MML
data, err := mmlclient.MMLSendMsgToString(neInfo.Ip, msg) data, err := mmlclient.MMLSendMsgToString(neInfo.Ip, msg)