Skip to content

Commit

Permalink
fix office file ext
Browse files Browse the repository at this point in the history
  • Loading branch information
kuaifan committed Dec 13, 2021
1 parent f1d87cf commit c36b10a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/Http/Controllers/Api/FileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,14 @@ public function add()
])) {
return Base::retError('类型错误');
}
$ext = '';
if (in_array($type, [
'word',
'excel',
'ppt',
])) {
$ext = str_replace(['word', 'excel', 'ppt'], ['docx', 'xlsx', 'pptx'], $type);
}
//
$userid = $user->userid;
if ($pid > 0) {
Expand All @@ -161,6 +169,7 @@ public function add()
'pid' => $pid,
'name' => $name,
'type' => $type,
'ext' => $ext,
'userid' => $userid,
'created_id' => $user->userid,
]);
Expand Down Expand Up @@ -201,6 +210,7 @@ public function copy()
'pid' => $row->pid,
'name' => $name,
'type' => $row->type,
'ext' => $row->ext,
'userid' => $userid,
'created_id' => $user->userid,
]);
Expand Down

0 comments on commit c36b10a

Please sign in to comment.