mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-24 02:48:12 +00:00
perf: 共享的文件禁止移动到另一个共享文件夹内
This commit is contained in:
parent
529b4bec31
commit
092506e9ab
@ -363,6 +363,15 @@ class FileController extends AbstractController
|
|||||||
$file = File::permissionFind($id, 1000);
|
$file = File::permissionFind($id, 1000);
|
||||||
//
|
//
|
||||||
if ($pid > 0) {
|
if ($pid > 0) {
|
||||||
|
if ($toShareFile) {
|
||||||
|
if ($file->share) {
|
||||||
|
throw new ApiException("{$file->name} 当前正在共享,无法移动到另一个共享文件夹内");
|
||||||
|
}
|
||||||
|
if ($file->isSubShare()) {
|
||||||
|
throw new ApiException("{$file->name} 内含有共享文件,无法移动到另一个共享文件夹内");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
$tmpId = $pid;
|
$tmpId = $pid;
|
||||||
while ($tmpId > 0) {
|
while ($tmpId > 0) {
|
||||||
if ($id == $tmpId) {
|
if ($id == $tmpId) {
|
||||||
@ -370,11 +379,6 @@ class FileController extends AbstractController
|
|||||||
}
|
}
|
||||||
$tmpId = intval(File::whereId($tmpId)->value('pid'));
|
$tmpId = intval(File::whereId($tmpId)->value('pid'));
|
||||||
}
|
}
|
||||||
if ($file->share && $toShareFile) {
|
|
||||||
$file->share = 0;
|
|
||||||
$file->save();
|
|
||||||
FileUser::deleteFileAll($file->id, $file->userid);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
$file->pid = $pid;
|
$file->pid = $pid;
|
||||||
@ -951,7 +955,7 @@ class FileController extends AbstractController
|
|||||||
// 设置共享
|
// 设置共享
|
||||||
$action = "update";
|
$action = "update";
|
||||||
if ($force === 0) {
|
if ($force === 0) {
|
||||||
if (File::where("pids", "like", "%,{$file->id},%")->whereShare(1)->exists()) {
|
if ($file->isSubShare()) {
|
||||||
return Base::retError('此文件夹内已有共享文件夹', [], -3001);
|
return Base::retError('此文件夹内已有共享文件夹', [], -3001);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -160,6 +160,15 @@ class File extends AbstractModel
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 目录内是否存在共享文件或文件夹
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isSubShare()
|
||||||
|
{
|
||||||
|
return $this->type == 'folder' && File::where("pids", "like", "%,{$this->id},%")->whereShare(1)->exists();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置/关闭 共享(同时遍历取消里面的共享)
|
* 设置/关闭 共享(同时遍历取消里面的共享)
|
||||||
* @param $share
|
* @param $share
|
||||||
|
|||||||
@ -1164,20 +1164,16 @@ export default {
|
|||||||
this.$refs.linkInput.focus({cursor:'all'});
|
this.$refs.linkInput.focus({cursor:'all'});
|
||||||
},
|
},
|
||||||
|
|
||||||
shearTo(force = false) {
|
shearTo() {
|
||||||
if (this.shearIds.length == 0) {
|
if (this.shearIds.length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (force !== true
|
if (this.isParentShare) {
|
||||||
&& this.isParentShare
|
const tmpFile = this.files.find(({id, share}) => share && this.shearIds.includes(id));
|
||||||
&& this.files.findIndex(({id, share}) => share && this.shearIds.includes(id)) > -1) {
|
if (tmpFile) {
|
||||||
$A.modalConfirm({
|
$A.modalError(`${tmpFile.name} 当前正在共享,无法移动到另一个共享文件夹内`)
|
||||||
content: '剪切板含有共享文件,粘贴到共享文件夹中原共享属性将失效。',
|
return;
|
||||||
onOk: () => {
|
}
|
||||||
this.shearTo(true)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
this.$store.dispatch("call", {
|
this.$store.dispatch("call", {
|
||||||
url: 'file/move',
|
url: 'file/move',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user