Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/config/app.cfg.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
// 附件url
define('ATTACHMENT_URL', ROOT_URL . 'attachment/');

// office支持实时预览
define('IS_OFFICE_PREVIEW', (boolean)$appConfig['office_preview']['enanle']);
define('OFFICE_PREVIEW_API', $appConfig['office_preview']['office_api']);
define('OFFICE_PREVIEW_SUFFIX_MAP', (array)$appConfig['office_preview']['office_suffix_map']);

// 当前版本号
define('MASTERLAB_VERSION', $appConfig['version']);

Expand Down
6 changes: 6 additions & 0 deletions app/ctrl/issue/Detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,12 @@ public function get()
foreach ($attachmentDatas as $f) {
$file = [];
$file['thumbnailUrl'] = ATTACHMENT_URL . $f['file_name'];

// 支持office文件实时预览
$file_suffix = substr(strrchr( $f['file_name'], '.'), 1);
if (IS_OFFICE_PREVIEW && in_array($file_suffix, OFFICE_PREVIEW_SUFFIX_MAP)) {
$file['thumbnailUrl'] = OFFICE_PREVIEW_API . ATTACHMENT_URL . $f['file_name'];
}
$file['size'] = $f['file_size'];
$file['name'] = $f['origin_name'];
$file['uuid'] = $f['uuid'];
Expand Down
5 changes: 5 additions & 0 deletions config.tpl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ xhprof:
enable: false
rate: 1

office_preview:
enanle: false
office_api: https://view.officeapps.live.com/op/view.aspx?src=
office_suffix_map: ["ppt","pptx","xls","xlsx","doc","docx"]

cache:
enable: {{cache_enable}}
expire: 864000
Expand Down