feat: update ppid files services
This commit is contained in:
parent
dca71f253a
commit
3a1335720d
|
|
@ -16,7 +16,6 @@ import (
|
|||
"log"
|
||||
"math/rand"
|
||||
"mime"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
|
@ -105,6 +104,22 @@ func (_i *ppidDataFilesService) Save(c *fiber.Ctx) (err error) {
|
|||
}
|
||||
files := form.File["files"]
|
||||
|
||||
_i.Log.Info().Str("timestamp", time.Now().
|
||||
Format(time.RFC3339)).Str("Service", "Save").
|
||||
Interface("titlesString", titlesString).Msg("")
|
||||
_i.Log.Info().Str("timestamp", time.Now().
|
||||
Format(time.RFC3339)).Str("Service", "Save").
|
||||
Interface("typesString", typesString).Msg("")
|
||||
_i.Log.Info().Str("timestamp", time.Now().
|
||||
Format(time.RFC3339)).Str("Service", "Save").
|
||||
Interface("positionsString", positionsString).Msg("")
|
||||
_i.Log.Info().Str("timestamp", time.Now().
|
||||
Format(time.RFC3339)).Str("Service", "Save").
|
||||
Interface("urlsString", urlsString).Msg("")
|
||||
_i.Log.Info().Str("timestamp", time.Now().
|
||||
Format(time.RFC3339)).Str("Service", "Save").
|
||||
Interface("urls", urls).Msg("")
|
||||
|
||||
fileCounter := 0
|
||||
urlCounter := 0
|
||||
|
||||
|
|
@ -113,6 +128,11 @@ func (_i *ppidDataFilesService) Save(c *fiber.Ctx) (err error) {
|
|||
Interface("form", files).Msg("")
|
||||
|
||||
for index, fileType := range types {
|
||||
|
||||
_i.Log.Info().Str("timestamp", time.Now().
|
||||
Format(time.RFC3339)).Str("Service", "Save").
|
||||
Interface("types", fileType).Msg("")
|
||||
|
||||
position := &positions[index]
|
||||
positionInt64, err := strconv.ParseInt(*position, 10, 0)
|
||||
if err != nil {
|
||||
|
|
@ -135,14 +155,14 @@ func (_i *ppidDataFilesService) Save(c *fiber.Ctx) (err error) {
|
|||
|
||||
if fileType == "url" {
|
||||
url := urls[urlCounter]
|
||||
filename := path.Base(url)
|
||||
//filename := path.Base(url)
|
||||
//filenameWithoutExt := filepath.Clean(filename[:len(filename)-len(filepath.Ext(filename))])
|
||||
extension := filepath.Ext(filename)[1:]
|
||||
//extension := filepath.Ext(filename)[1:]
|
||||
//title := strings.ReplaceAll(filenameWithoutExt, "-", " ")
|
||||
|
||||
//req.Title = &title
|
||||
req.FileType = &extension
|
||||
req.FileName = &filename
|
||||
//req.FileType = &extension
|
||||
req.FileName = &title
|
||||
req.FileUrl = &url
|
||||
|
||||
urlCounter += 1
|
||||
|
|
|
|||
Loading…
Reference in New Issue