package dao import ( "context" "oss/consts" "oss/model/dto" "oss/model/entity" "gitea.com/red-future/common/db/gfdb" "github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/guid" ) var File = &file{} type file struct{} // Insert 插入 func (d *file) Insert(ctx context.Context, req *dto.UploadFile) (res *entity.File, err error) { if err = gconv.Struct(req, &res); err != nil { return } res.Bid = guid.S() _, err = gfdb.DB(ctx).Model(ctx, consts.FileCollection).Insert(&res) return }