文件生成路径
This commit is contained in:
@@ -28,11 +28,17 @@ type FileNameMeta struct {
|
||||
// 生成告警文件文件名
|
||||
// GD-FM-OMC-100A-V1.1.0-20150611011603-001.txt.zip
|
||||
func FileName(meta *FileNameMeta) string {
|
||||
// 路径分层
|
||||
timeDayStr := time.Now().Format("20060102")
|
||||
filePath := path.Join(meta.FTPRoot, meta.Province, "HX", "RJ", "OMC", "FM", timeDayStr)
|
||||
|
||||
// 文件名组合
|
||||
reqIdStr := fmt.Sprintf("%03s", meta.ReqId)
|
||||
timeStr := time.Now().Format("20060102150405")
|
||||
fileNameGroup := []string{meta.Province, "FM", "OMC", meta.DeviceCode, "V0", timeStr, reqIdStr}
|
||||
fileName := strings.Join(fileNameGroup, "-")
|
||||
return path.Join(meta.FTPRoot, strings.ToUpper(fileName)+meta.Suffix)
|
||||
fileName = strings.ToUpper(fileName) + meta.Suffix
|
||||
return path.Join(filePath, fileName)
|
||||
}
|
||||
|
||||
func CreateFile(filePath string, data []model.OmcAlarm) error {
|
||||
|
||||
Reference in New Issue
Block a user