fix: issues
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"backend/common/media_store"
|
||||
"backend/database/models/qvyun/public/table"
|
||||
@@ -182,14 +183,15 @@ func (svc *Service) Upsert(ctx context.Context, tenantId int64, item media_store
|
||||
tbl := table.Medias
|
||||
stmt := tbl.
|
||||
INSERT(tbl.TenantID, tbl.Hash, tbl.Title, tbl.Price, tbl.Resources, tbl.Publish).
|
||||
VALUES(Int(tenantId), String(item.Hash), String(item.Name), Int(item.Price()), Json(resources), Bool(true)).
|
||||
VALUES(Int(tenantId), String(item.Hash), String(item.Name), Int(item.Price()), Json(resources.MustValue()), Bool(true)).
|
||||
ON_CONFLICT(tbl.Hash).
|
||||
DO_UPDATE(
|
||||
SET(
|
||||
tbl.Title.SET(String(item.Name)),
|
||||
tbl.Price.SET(Int(item.Price())),
|
||||
tbl.Resources.SET(Json(resources)),
|
||||
tbl.Resources.SET(Json(resources.MustValue())),
|
||||
tbl.Publish.SET(Bool(true)),
|
||||
tbl.UpdatedAt.SET(TimestampT(time.Now())),
|
||||
),
|
||||
)
|
||||
log.Debug(stmt.DebugSql())
|
||||
|
||||
Reference in New Issue
Block a user