migrate controllers
Some checks failed
build quyun / Build (push) Failing after 1m30s

This commit is contained in:
2025-12-19 23:33:02 +08:00
parent 557a641f41
commit 49072ddd79
37 changed files with 1944 additions and 69 deletions

View File

@@ -5,8 +5,9 @@ import (
"path/filepath"
"time"
"quyun/v2/app/model"
"quyun/v2/database/fields"
"quyun/v2/app/services"
"quyun/v2/database/models"
"quyun/v2/pkg/fields"
"quyun/v2/pkg/utils"
"quyun/v2/providers/ali"
"quyun/v2/providers/app"
@@ -17,6 +18,7 @@ import (
log "github.com/sirupsen/logrus"
_ "go.ipao.vip/atom"
"go.ipao.vip/atom/contracts"
"go.ipao.vip/gen/types"
)
var _ contracts.JobArgs = (*VideoStoreShort)(nil)
@@ -57,7 +59,7 @@ func (w *VideoStoreShortWorker) Work(ctx context.Context, job *Job[VideoStoreSho
log.Infof("[Start] Working on job with strings: %+v", job.Args)
defer log.Infof("[End] Finished %s", job.Args.Kind())
media, err := model.MediasModel().GetByHash(ctx, job.Args.MediaHash)
media, err := services.Medias.GetByHash(ctx, job.Args.MediaHash)
if err != nil {
log.Errorf("Error getting media by ID: %v", err)
return JobCancel(err)
@@ -90,13 +92,13 @@ func (w *VideoStoreShortWorker) Work(ctx context.Context, job *Job[VideoStoreSho
log.Infof("got file size %s %d", job.Args.FilePath, fileSize)
// save to db and relate to master
mediaModel := &model.Medias{
mediaModel := &models.Media{
Name: "[试听] " + media.Name,
MimeType: media.MimeType,
Size: fileSize,
Path: filePath,
Hash: fileMd5,
Metas: fields.ToJson(fields.MediaMetas{
Metas: types.NewJSONType(fields.MediaMetas{
ParentHash: media.Hash,
Short: true,
Duration: duration,