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

@@ -6,8 +6,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"
@@ -18,6 +19,7 @@ import (
log "github.com/sirupsen/logrus"
_ "go.ipao.vip/atom"
"go.ipao.vip/atom/contracts"
"go.ipao.vip/gen/types"
)
var _ contracts.JobArgs = (*VideoExtractHeadImage)(nil)
@@ -57,7 +59,7 @@ func (w *VideoExtractHeadImageWorker) Work(ctx context.Context, job *Job[VideoEx
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)
@@ -88,13 +90,13 @@ func (w *VideoExtractHeadImageWorker) Work(ctx context.Context, job *Job[VideoEx
name := "[展示图]" + media.Name + ".jpg"
// create a new media record for the image
imageMedia := &model.Medias{
imageMedia := &models.Media{
Name: name,
MimeType: "image/jpeg",
Size: fileSize,
Path: w.oss.GetSavePath(filename),
Hash: fileMd5,
Metas: fields.ToJson(fields.MediaMetas{
Metas: types.NewJSONType(fields.MediaMetas{
ParentHash: media.Hash,
}),
}