国内有哪些同步盘?好用的同步网盘有哪些?
418
2022-07-15
1. 共享文件夹列表
从 中获取别人共享的文件:
whereStr := fmt.Sprintf("auth.uid = %d and auth.read = 1 and auth.is_share = 1", user.UserID) folderList, err := entity.GetRelateFolderList(whereStr, req.PageOffset, req.PageSize)
并将切片内的赋值到返回切片中:
for _, folderRow := range folderList { isFamilyPath := 0 if filepath.Base(folderRow.AbsPath) == types.FolderFamilyDir { isFamilyPath = 1 } list = append(list, Info{ ID: folderRow.Id, Name: folderRow.Name, Path: fmt.Sprintf("/s/%d", folderRow.Id), FromUser: folderRow.FromUser, Read: folderRow.Read, Write: folderRow.Write, Deleted: folderRow.Deleted, IsFamilyPath: isFamilyPath, }) }
2. 共享文件资源
共享文件夹设置成分享时,需要将原权限删除,并重新组建一个新的权限数组写入至数据库中。
// path转换为实际路径 folderId, err = utils.GetAbsFolderIdFromPath(path) for _, uID := range req.ToUsers { // 权限存在则删除 err = entity.DelFolderAuthByUidAndFolderId(uID, folderId) folderAuthCreate := entity.FolderAuth{ Uid: uID, FromUser: nickname, IsShare: 1, FolderId: folderId, Read: req.Read, Write: req.Write, Deleted: req.Deleted, } folderAuthCreates = append(folderAuthCreates, folderAuthCreate) } if folderAuthCreates != nil { if err = entity.BatchInsertAuth(entity.GetDB(), folderAuthCreates); err != nil { err = errors.Wrap(err, errors.InternalServerErr) return } }
3.惯例
如果你对本文有任何疑问或者高见,关注智汀公众号共同交流探讨(欢迎加入微信号:13326423643可以免费赠送“智能开关或其他智能硬件”哦)。
发表评论
暂时没有评论,来抢沙发吧~