mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-20 07:58:12 +00:00
fix: 修复共享文件移动到共享文件夹内共享属性错乱的问题
This commit is contained in:
parent
dc3b666635
commit
031dac36e6
@ -351,25 +351,30 @@ class FileController extends AbstractController
|
|||||||
if (count($ids) > 100) {
|
if (count($ids) > 100) {
|
||||||
return Base::retError('一次最多只能移动100个文件或文件夹');
|
return Base::retError('一次最多只能移动100个文件或文件夹');
|
||||||
}
|
}
|
||||||
|
$toShareFile = false;
|
||||||
if ($pid > 0) {
|
if ($pid > 0) {
|
||||||
File::permissionFind($pid, 1);
|
$tmpFile = File::permissionFind($pid, 1);
|
||||||
|
$toShareFile = $tmpFile->getShareInfo();
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
$files = [];
|
$files = [];
|
||||||
AbstractModel::transaction(function() use ($pid, $ids, &$files) {
|
AbstractModel::transaction(function() use ($pid, $ids, $toShareFile, &$files) {
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
$file = File::permissionFind($id, 1000);
|
$file = File::permissionFind($id, 1000);
|
||||||
//
|
//
|
||||||
if ($pid > 0) {
|
if ($pid > 0) {
|
||||||
$arr = [];
|
$tmpId = $pid;
|
||||||
$tid = $pid;
|
while ($tmpId > 0) {
|
||||||
while ($tid > 0) {
|
if ($id == $tmpId) {
|
||||||
$arr[] = $tid;
|
|
||||||
$tid = intval(File::whereId($tid)->value('pid'));
|
|
||||||
}
|
|
||||||
if (in_array($id, $arr)) {
|
|
||||||
throw new ApiException('移动位置错误');
|
throw new ApiException('移动位置错误');
|
||||||
}
|
}
|
||||||
|
$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;
|
||||||
|
|||||||
@ -1164,10 +1164,21 @@ export default {
|
|||||||
this.$refs.linkInput.focus({cursor:'all'});
|
this.$refs.linkInput.focus({cursor:'all'});
|
||||||
},
|
},
|
||||||
|
|
||||||
shearTo() {
|
shearTo(force = false) {
|
||||||
if (this.shearIds.length == 0) {
|
if (this.shearIds.length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (force !== true
|
||||||
|
&& this.isParentShare
|
||||||
|
&& this.files.findIndex(({id, share}) => share && this.shearIds.includes(id)) > -1) {
|
||||||
|
$A.modalConfirm({
|
||||||
|
content: '剪切板含有共享文件,粘贴到共享文件夹中原共享属性将失效。',
|
||||||
|
onOk: () => {
|
||||||
|
this.shearTo(true)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.$store.dispatch("call", {
|
this.$store.dispatch("call", {
|
||||||
url: 'file/move',
|
url: 'file/move',
|
||||||
data: {
|
data: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user