Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
workbiu-admin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gxx
workbiu-admin
Commits
8ec89ed5
Commit
8ec89ed5
authored
Dec 13, 2017
by
mengyixi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
groupossspace
parent
f7dc69e9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
1 deletion
+25
-1
FileServiceContract.php
app/Contracts/FileServiceContract.php
+1
-0
FileController.php
app/Http/Controllers/FileController.php
+11
-1
FileService.php
app/Services/FileService.php
+12
-0
web.php
routes/web.php
+1
-0
No files found.
app/Contracts/FileServiceContract.php
View file @
8ec89ed5
...
...
@@ -17,5 +17,6 @@ interface FileServiceContract
public
function
delete
(
$file_id
);
public
function
groupSpace
(
$group_id
);
public
function
ossSpace
();
public
function
groupOssSpace
(
$group_id
);
public
function
countFile
(
$group_id
);
}
\ No newline at end of file
app/Http/Controllers/FileController.php
View file @
8ec89ed5
...
...
@@ -42,7 +42,7 @@ class FileController extends Controller
return
$finalspace
;
}
public
function
ossSpace
(
Request
$request
)
public
function
ossSpace
()
{
$result
=
$this
->
mFile
->
ossSpace
();
...
...
@@ -52,6 +52,16 @@ class FileController extends Controller
return
$finalspace
;
}
public
function
groupOssSpace
(
Request
$request
)
{
$group_id
=
$request
->
group_id
;
$result
=
$this
->
mFile
->
groupOssSpace
(
$group_id
);
$mbyte
=
$result
/
1048576
;
$space
=
10
-
$mbyte
;
$finalspace
=
array
([
"value"
=>
$space
,
"name"
=>
"剩余空间"
],[
"value"
=>
$mbyte
,
"name"
=>
"已用空间"
]);
return
$finalspace
;
}
public
function
countFile
(
Request
$request
)
{
$group_id
=
$request
->
group_id
;
...
...
app/Services/FileService.php
View file @
8ec89ed5
...
...
@@ -87,6 +87,18 @@ class FileService implements FileServiceContract
return
$space
;
}
public
function
groupOssSpace
(
$group_id
)
{
$files
=
File
::
where
([
"group_id"
=>
$group_id
])
->
get
()
->
unique
(
"pointer"
);
$space
=
0
;
foreach
(
$files
as
$file
)
{
$size
=
$file
->
size
;
$space
=
$space
+
$size
;
}
return
$space
;
}
public
function
countFile
(
$group_id
)
{
$files
=
File
::
where
([
"group_id"
=>
$group_id
])
->
get
();
...
...
routes/web.php
View file @
8ec89ed5
...
...
@@ -117,6 +117,7 @@ Route::get('/',function (){return view('login');})->name('admin.login');
Route
::
delete
(
'delete_file'
,
'FileController@delete'
)
->
name
(
'file.delete'
);
Route
::
get
(
'group_space'
,
'FileController@groupSpace'
)
->
name
(
'file.groupSpace'
);
Route
::
get
(
'oss_space'
,
'FileController@ossSpace'
)
->
name
(
'file.ossSpace'
);
Route
::
get
(
'group_oss_space'
,
'FileController@groupOssSpace'
)
->
name
(
'file.groupOssSpace'
);
Route
::
get
(
'count_file'
,
'FileController@countFile'
)
->
name
(
'file.countFile'
);
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment