diff --git a/app/Http/Controllers/Api/FileController.php b/app/Http/Controllers/Api/FileController.php index 9a59f5f86..c9aa17b79 100755 --- a/app/Http/Controllers/Api/FileController.php +++ b/app/Http/Controllers/Api/FileController.php @@ -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) { @@ -161,6 +169,7 @@ public function add() 'pid' => $pid, 'name' => $name, 'type' => $type, + 'ext' => $ext, 'userid' => $userid, 'created_id' => $user->userid, ]); @@ -201,6 +210,7 @@ public function copy() 'pid' => $row->pid, 'name' => $name, 'type' => $row->type, + 'ext' => $row->ext, 'userid' => $userid, 'created_id' => $user->userid, ]);