Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop
This commit is contained in:
commit
25bf157977
|
@ -70,27 +70,26 @@ func (upload *Upload) UploadFileByBase64(req *UploadBaseReq) (*UploadBaseRes, er
|
|||
|
||||
var uploadBaseRes = UploadBaseRes{}
|
||||
|
||||
// var refresh bool
|
||||
var refresh bool
|
||||
|
||||
// if req.ResourceId != "" {
|
||||
// refresh = true
|
||||
// }
|
||||
if req.ResourceId != "" {
|
||||
refresh = true
|
||||
resourceId = req.ResourceId
|
||||
}
|
||||
err := upload.MysqlConn.Transaction(func(tx *gorm.DB) (err error) {
|
||||
var resourceInfo *gmodel.FsResource
|
||||
|
||||
if req.ResourceId == "" {
|
||||
if !refresh {
|
||||
err = tx.Where("resource_id =?", resourceId).Take(&resourceInfo).Error
|
||||
}
|
||||
|
||||
if req.ResourceId == "" && err == nil && resourceInfo.ResourceId != "" {
|
||||
if err == nil && resourceInfo.ResourceId != "" {
|
||||
uploadBaseRes.Status = 1
|
||||
uploadBaseRes.ResourceId = resourceId
|
||||
uploadBaseRes.ResourceUrl = *resourceInfo.ResourceUrl
|
||||
} else {
|
||||
if req.ResourceId != "" {
|
||||
resourceId = req.ResourceId
|
||||
refresh = true
|
||||
}
|
||||
|
||||
}
|
||||
if refresh {
|
||||
dist, contentType, err := FileBase64ToByte(req.FileData)
|
||||
|
||||
if err != nil {
|
||||
|
@ -125,7 +124,7 @@ func (upload *Upload) UploadFileByBase64(req *UploadBaseReq) (*UploadBaseRes, er
|
|||
uploadBaseRes.ResourceUrl = url
|
||||
var version string = "0.0.1"
|
||||
var nowTime = time.Now().UTC()
|
||||
if req.Refresh == 1 {
|
||||
if refresh {
|
||||
err = tx.Save(&gmodel.FsResource{
|
||||
ResourceId: resourceId,
|
||||
UserId: &req.UserId,
|
||||
|
|
Loading…
Reference in New Issue
Block a user