mirror of
https://github.com/tgdrive/teldrive.git
synced 2025-01-09 00:29:57 +08:00
fix type
This commit is contained in:
parent
b4366686f7
commit
2172a5af7b
2 changed files with 7 additions and 4 deletions
|
@ -7,7 +7,7 @@ import (
|
|||
type Upload struct {
|
||||
ID string `gorm:"type:text;primary_key;default:generate_uid(16)"`
|
||||
UploadId string `gorm:"type:text"`
|
||||
UserId string `gorm:"type:bigint"`
|
||||
UserId int64 `gorm:"type:bigint"`
|
||||
Name string `gorm:"type:text"`
|
||||
PartNo int `gorm:"type:integer"`
|
||||
TotalParts int `gorm:"type:integer"`
|
||||
|
|
|
@ -63,11 +63,15 @@ func (us *UploadService) UploadFile(c *gin.Context) (*schemas.UploadPartOut, *ty
|
|||
return nil, &types.AppError{Error: errors.New("filename missing"), Code: http.StatusBadRequest}
|
||||
}
|
||||
|
||||
userId, session := getUserAuth(c)
|
||||
|
||||
uploadId := c.Param("id")
|
||||
|
||||
var uploadPart []models.Upload
|
||||
|
||||
us.Db.Model(&models.Upload{}).Where("upload_id = ?", uploadId).Where("part_no = ?", uploadQuery.PartNo).Find(&uploadPart)
|
||||
us.Db.Model(&models.Upload{}).Where("upload_id = ?", uploadId).Where("part_no = ?", uploadQuery.PartNo).
|
||||
Where("user_id = ?", userId).
|
||||
Find(&uploadPart)
|
||||
|
||||
if len(uploadPart) == 1 {
|
||||
out := mapper.MapUploadSchema(&uploadPart[0])
|
||||
|
@ -82,8 +86,6 @@ func (us *UploadService) UploadFile(c *gin.Context) (*schemas.UploadPartOut, *ty
|
|||
|
||||
var msgId int
|
||||
|
||||
userId, session := getUserAuth(c)
|
||||
|
||||
tokens, err := GetBotsToken(c, userId)
|
||||
|
||||
if err != nil {
|
||||
|
@ -166,6 +168,7 @@ func (us *UploadService) UploadFile(c *gin.Context) (*schemas.UploadPartOut, *ty
|
|||
Size: fileSize,
|
||||
PartNo: uploadQuery.PartNo,
|
||||
TotalParts: uploadQuery.TotalParts,
|
||||
UserId: userId,
|
||||
}
|
||||
|
||||
if err := us.Db.Create(partUpload).Error; err != nil {
|
||||
|
|
Loading…
Reference in a new issue