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