diff --git a/app/Http/Controllers/Api/DialogController.php b/app/Http/Controllers/Api/DialogController.php
index a2cadfe63..6824a0c13 100755
--- a/app/Http/Controllers/Api/DialogController.php
+++ b/app/Http/Controllers/Api/DialogController.php
@@ -9,6 +9,7 @@ use App\Models\WebSocketDialog;
use App\Models\WebSocketDialogMsg;
use App\Models\WebSocketDialogMsgRead;
use App\Module\Base;
+use Carbon\Carbon;
use Request;
use Response;
@@ -349,6 +350,9 @@ class DialogController extends AbstractController
* @apiName msg__detail
*
* @apiParam {Number} msg_id 消息ID
+ * @apiParam {String} only_update_at 仅获取update_at字段
+ * - no (默认)
+ * - yes
*
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
* @apiSuccess {String} msg 返回信息(错误描述)
@@ -359,11 +363,20 @@ class DialogController extends AbstractController
User::auth();
//
$msg_id = intval(Request::input('msg_id'));
+ $only_update_at = Request::input('only_update_at', 'no');
//
$dialogMsg = WebSocketDialogMsg::whereId($msg_id)->first();
if (empty($dialogMsg)) {
return Base::retError("文件不存在");
}
+ //
+ if ($only_update_at == 'yes') {
+ return Base::retSuccess('success', [
+ 'id' => $dialogMsg->id,
+ 'update_at' => Carbon::parse($dialogMsg->updated_at)->toDateTimeString()
+ ]);
+ }
+ //
$data = $dialogMsg->toArray();
//
if ($data['type'] == 'file') {
diff --git a/app/Http/Controllers/Api/FileController.php b/app/Http/Controllers/Api/FileController.php
index 05ee13379..edc340824 100755
--- a/app/Http/Controllers/Api/FileController.php
+++ b/app/Http/Controllers/Api/FileController.php
@@ -9,12 +9,11 @@ use App\Models\FileContent;
use App\Models\FileLink;
use App\Models\FileUser;
use App\Models\User;
-use App\Models\WebSocketDialogMsg;
use App\Module\Base;
use App\Module\Ihttp;
+use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
use Request;
-use Response;
/**
* @apiDefine file
@@ -383,7 +382,10 @@ class FileController extends AbstractController
* @apiParam {Number|String} id
* - Number: 文件ID(需要登录)
* - String: 链接码(不需要登录,用于预览)
- * @apiParam {String} down 直接下载
+ * @apiParam {String} only_update_at 仅获取update_at字段
+ * - no (默认)
+ * - yes
+ * @apiParam {String} down 直接下载
* - no: 浏览(默认)
* - yes: 下载(office文件直接下载)
*
@@ -395,6 +397,7 @@ class FileController extends AbstractController
{
$id = Request::input('id');
$down = Request::input('down', 'no');
+ $only_update_at = Request::input('only_update_at', 'no');
//
if (Base::isNumber($id)) {
User::auth();
@@ -409,6 +412,13 @@ class FileController extends AbstractController
return Base::retError('参数错误');
}
//
+ if ($only_update_at == 'yes') {
+ return Base::retSuccess('success', [
+ 'id' => $file->id,
+ 'update_at' => Carbon::parse($file->updated_at)->toDateTimeString()
+ ]);
+ }
+ //
$content = FileContent::whereFid($file->id)->orderByDesc('id')->first();
return FileContent::formatContent($file, $content?->content, $down == 'yes');
}
diff --git a/app/Http/Controllers/Api/ProjectController.php b/app/Http/Controllers/Api/ProjectController.php
index 2515486d7..28892a35d 100755
--- a/app/Http/Controllers/Api/ProjectController.php
+++ b/app/Http/Controllers/Api/ProjectController.php
@@ -1099,7 +1099,10 @@ class ProjectController extends AbstractController
* @apiGroup project
* @apiName task__filedetail
*
- * @apiParam {Number} file_id 文件ID
+ * @apiParam {Number} file_id 文件ID
+ * @apiParam {String} only_update_at 仅获取update_at字段
+ * - no (默认)
+ * - yes
*
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
* @apiSuccess {String} msg 返回信息(错误描述)
@@ -1110,11 +1113,20 @@ class ProjectController extends AbstractController
User::auth();
//
$file_id = intval(Request::input('file_id'));
+ $only_update_at = Request::input('only_update_at', 'no');
//
$file = ProjectTaskFile::find($file_id);
if (empty($file)) {
return Base::retError("文件不存在");
}
+ //
+ if ($only_update_at == 'yes') {
+ return Base::retSuccess('success', [
+ 'id' => $file->id,
+ 'update_at' => Carbon::parse($file->updated_at)->toDateTimeString()
+ ]);
+ }
+ //
$data = $file->toArray();
$data['path'] = $file->getRawOriginal('path');
//
diff --git a/resources/assets/js/components/OnlyOffice.vue b/resources/assets/js/components/OnlyOffice.vue
index e43ad89a1..9dc2f2e81 100644
--- a/resources/assets/js/components/OnlyOffice.vue
+++ b/resources/assets/js/components/OnlyOffice.vue
@@ -60,6 +60,7 @@ export default {
type: Boolean,
default: false
},
+ documentKey: Function
},
data() {
@@ -91,10 +92,6 @@ export default {
fileName() {
return this.value.name;
},
-
- fileUpdatedAt() {
- return this.value.updated_at ? $A.Date(this.value.updated_at, true) : '';
- }
},
watch: {
@@ -108,8 +105,17 @@ export default {
this.loadIng--;
if (e !== null) {
$A.modalAlert("组件加载失败!");
+ return;
+ }
+ if (!this.documentKey) {
+ this.handleClose();
+ return
+ }
+ const documentKey = this.documentKey();
+ if (documentKey && documentKey.then) {
+ documentKey.then(this.loadFile);
} else {
- this.loadFile()
+ this.loadFile();
}
})
},
@@ -130,7 +136,7 @@ export default {
return type;
},
- loadFile() {
+ loadFile(keyAppend = '') {
if (this.docEditor !== null) {
this.docEditor.destroyEditor();
this.docEditor = null;
@@ -152,7 +158,7 @@ export default {
const config = {
"document": {
"fileType": this.fileType,
- "key": `${this.fileType}-${fileKey}-${this.fileUpdatedAt}`,
+ "key": `${this.fileType}-${fileKey}-${keyAppend}`,
"title": fileName,
"url": `http://nginx/api/file/content/?id=${fileKey}&token=${this.userToken}`,
},
diff --git a/resources/assets/js/pages/manage/components/FileContent.vue b/resources/assets/js/pages/manage/components/FileContent.vue
index d3878abc7..618385703 100644
--- a/resources/assets/js/pages/manage/components/FileContent.vue
+++ b/resources/assets/js/pages/manage/components/FileContent.vue
@@ -52,7 +52,7 @@
-
+
@@ -330,6 +330,22 @@ export default {
this.unsaveTip = false;
},
+ documentKey() {
+ return new Promise(resolve => {
+ this.$store.dispatch("call", {
+ url: 'file/content',
+ data: {
+ id: this.fileId,
+ only_update_at: 'yes'
+ },
+ }).then(({data}) => {
+ resolve($A.Date(data.update_at, true))
+ }).catch(() => {
+ resolve(0)
+ });
+ })
+ },
+
formatName(file) {
let {name, ext} = file;
if (ext != '') {
diff --git a/resources/assets/js/pages/manage/components/FilePreview.vue b/resources/assets/js/pages/manage/components/FilePreview.vue
index 2d7b90fbf..061e1900f 100644
--- a/resources/assets/js/pages/manage/components/FilePreview.vue
+++ b/resources/assets/js/pages/manage/components/FilePreview.vue
@@ -29,7 +29,7 @@
-
+
@@ -144,6 +144,22 @@ export default {
})
},
+ documentKey() {
+ return new Promise(resolve => {
+ this.$store.dispatch("call", {
+ url: 'file/content',
+ data: {
+ id: this.code || this.file.id,
+ only_update_at: 'yes'
+ },
+ }).then(({data}) => {
+ resolve($A.Date(data.update_at, true))
+ }).catch(() => {
+ resolve(0)
+ });
+ })
+ },
+
exportMenu(act) {
switch (this.file.type) {
case 'mind':
diff --git a/resources/assets/js/pages/single/fileMsg.vue b/resources/assets/js/pages/single/fileMsg.vue
index 1dc61a3a2..19ae4f052 100644
--- a/resources/assets/js/pages/single/fileMsg.vue
+++ b/resources/assets/js/pages/single/fileMsg.vue
@@ -4,7 +4,7 @@
-
+
{{$L('不支持单独查看此消息')}}
@@ -68,6 +68,10 @@ export default {
},
},
computed: {
+ msgId() {
+ return $A.runNum(this.$route.params.id);
+ },
+
title() {
const {msg} = this.msgDetail;
if (msg && msg.name) {
@@ -99,7 +103,6 @@ export default {
return {
id: this.isOffice ? this.msgDetail.id : 0,
type: this.msgDetail.msg.ext,
- updated_at: this.msgDetail.created_at,
name: this.title,
}
},
@@ -122,15 +125,14 @@ export default {
},
methods: {
getInfo() {
- let msg_id = $A.runNum(this.$route.params.id);
- if (msg_id <= 0) {
+ if (this.msgId <= 0) {
return;
}
this.loadIng++;
this.$store.dispatch("call", {
url: 'dialog/msg/detail',
data: {
- msg_id,
+ msg_id: this.msgId,
},
}).then(({data}) => {
this.loadIng--;
@@ -146,6 +148,21 @@ export default {
}
});
});
+ },
+ documentKey() {
+ return new Promise(resolve => {
+ this.$store.dispatch("call", {
+ url: 'dialog/msg/detail',
+ data: {
+ msg_id: this.msgId,
+ only_update_at: 'yes'
+ },
+ }).then(({data}) => {
+ resolve($A.Date(data.update_at, true))
+ }).catch(() => {
+ resolve(0)
+ });
+ });
}
}
}
diff --git a/resources/assets/js/pages/single/fileTask.vue b/resources/assets/js/pages/single/fileTask.vue
index 129831cdf..433de83ad 100644
--- a/resources/assets/js/pages/single/fileTask.vue
+++ b/resources/assets/js/pages/single/fileTask.vue
@@ -4,7 +4,7 @@
-
+
{{$L('不支持单独查看此消息')}}
@@ -68,6 +68,10 @@ export default {
},
},
computed: {
+ fileId() {
+ return $A.runNum(this.$route.params.id);
+ },
+
title() {
const {name} = this.fileDetail;
if (name) {
@@ -99,8 +103,7 @@ export default {
return {
id: this.isOffice ? this.fileDetail.id : 0,
type: this.fileDetail.ext,
- updated_at: this.fileDetail.created_at,
- name: this.title
+ name: this.title,
}
},
officeCode() {
@@ -122,15 +125,14 @@ export default {
},
methods: {
getInfo() {
- let file_id = $A.runNum(this.$route.params.id);
- if (file_id <= 0) {
+ if (this.fileId <= 0) {
return;
}
this.loadIng++;
this.$store.dispatch("call", {
url: 'project/task/filedetail',
data: {
- file_id,
+ file_id: this.fileId,
},
}).then(({data}) => {
this.loadIng--;
@@ -146,6 +148,21 @@ export default {
}
});
});
+ },
+ documentKey() {
+ return new Promise(resolve => {
+ this.$store.dispatch("call", {
+ url: 'project/task/filedetail',
+ data: {
+ file_id: this.fileId,
+ only_update_at: 'yes'
+ },
+ }).then(({data}) => {
+ resolve($A.Date(data.update_at, true))
+ }).catch(() => {
+ resolve(0)
+ });
+ })
}
}
}