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
1161bafb
Commit
1161bafb
authored
Nov 09, 2017
by
gxx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化 项目控制器和服务中的部分代码 修复项目修改页面BUG
parent
9974939e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
40 additions
and
318 deletions
+40
-318
ProjectServiceContract.php
app/Contracts/ProjectServiceContract.php
+6
-12
ProjectController.php
app/Http/Controllers/ProjectController.php
+18
-16
UserController.php
app/Http/Controllers/UserController.php
+0
-1
Group.php
app/Models/Group.php
+1
-1
Project.php
app/Models/Project.php
+1
-1
ProjectService.php
app/Services/ProjectService.php
+6
-91
projectinformation.blade.php
resources/views/admin/project/projectinformation.blade.php
+3
-191
update.blade.php
resources/views/admin/project/update.blade.php
+3
-3
sidebar.blade.php
resources/views/admin/sidebar.blade.php
+2
-2
No files found.
app/Contracts/ProjectServiceContract.php
View file @
1161bafb
...
...
@@ -11,21 +11,15 @@ namespace App\Contracts;
interface
ProjectServiceContract
{
public
function
add
(
$name
,
$creator_id
,
$owner_id
,
$group_id
,
$brief
,
$cover_img
);
public
function
delete
(
$project_id
);
public
function
update
(
$id
,
$name
,
$creator_id
,
$owner_id
,
$group_id
,
$brief
,
$cover_img
);
public
function
get
(
$project_id
);
public
function
getAll
();
public
function
getAll
(
$group_id
);
public
function
simpleSearch
(
$id
,
$content
,
$item
);
public
function
addTask
(
$name
,
$project_id
,
$creator_id
,
$owner_id
,
$status
,
$brief
,
$starts_at
,
$ends_at
);
public
function
deleteTask
(
$id
);
public
function
updateTask
(
$id
,
$name
,
$project_id
,
$creator_id
,
$owner_id
,
$status
,
$brief
,
$starts_at
,
$ends_at
);
public
function
getTask
(
$id
);
public
function
getAllTask
();
public
function
simpleSearch
(
$id
,
$content
,
$item
);
public
function
add
(
$name
,
$creator_id
,
$owner_id
,
$group_id
,
$brief
,
$cover_img
);
public
function
delete
(
$project_id
);
public
function
update
(
$id
,
$name
,
$creator_id
,
$group_id
,
$brief
,
$cover_img
);
public
function
get
(
$project_id
);
}
\ No newline at end of file
app/Http/Controllers/ProjectController.php
View file @
1161bafb
...
...
@@ -21,25 +21,26 @@ class ProjectController extends Controller
{
$projectid
=
$request
->
id
;
$project
=
$this
->
mProject
->
get
(
$projectid
);
if
(
count
(
$project
)
>
0
){
if
(
project
){
return
view
(
'admin/project/projectinformation'
,
compact
(
'project'
));
}
else
{
echo
'项目查不到!'
;
return
back
();
}
}
// 查看团队所有项目
public
function
getAll
(
Request
$request
)
{
$groupid
=
$request
->
id
;
$projects
=
Group
::
find
(
$groupid
)
->
project
;
if
(
count
(
$projects
)
>
0
){
$groupId
=
$request
->
id
;
$projects
=
$this
->
mProject
->
getAll
(
$groupId
);
if
(
$projects
){
return
view
(
'admin/project/projecttables'
,
compact
(
'projects'
));
}
return
Message
::
makeError
(
'无数据!'
);
return
view
(
'admin/project/projecttables'
,
compact
(
'projects'
));
}
...
...
@@ -48,12 +49,12 @@ class ProjectController extends Controller
{
$projectid
=
$request
->
id
;
$project
=
$this
->
mProject
->
get
(
$projectid
);
$result
=
$project
;
if
(
count
(
$project
)
>
0
){
if
(
$project
){
return
view
(
'admin/project/update'
,
compact
(
'result'
));
}
echo
'没有此项目!'
;
return
back
();
return
Message
::
makeError
(
'错误'
);
}
...
...
@@ -63,16 +64,17 @@ class ProjectController extends Controller
$id
=
$request
->
id
;
$name
=
$request
->
name
;
$cover_img
=
$request
->
cover_img
;
$owner_id
=
$request
->
owner_id
;
$creator_id
=
$request
->
creator_id
;
$group_id
=
$request
->
group_id
;
$brief
=
$request
->
brief
;
$project
=
$this
->
mProject
->
update
(
$id
,
$name
,
$creator_id
,
$owner_id
,
$group_id
,
$brief
,
$cover_img
);
$project
=
$this
->
mProject
->
update
(
$id
,
$name
,
$creator_id
,
$group_id
,
$brief
,
$cover_img
);
if
(
$project
){
return
back
();
}
echo
'修改项目失败!'
;
return
back
();
}
...
...
app/Http/Controllers/UserController.php
View file @
1161bafb
...
...
@@ -55,7 +55,6 @@ class UserController extends Controller
if
(
$head_icon
==
null
){
$head_icon
=
null
;
}
$result
=
$this
->
mUser
->
update
(
$id
,
$phone
,
$user_name
,
$real_name
,
$gender
,
$email
,
$head_icon
);
if
(
$result
){
...
...
app/Models/Group.php
View file @
1161bafb
...
...
@@ -28,6 +28,6 @@ class Group extends Model
public
function
project
()
{
return
$this
->
hasMany
(
'App\Models\Project'
,
'
creator_
id'
);
return
$this
->
hasMany
(
'App\Models\Project'
,
'
group_id'
,
'
id'
);
}
}
app/Models/Project.php
View file @
1161bafb
...
...
@@ -13,7 +13,7 @@ class Project extends Model
public
function
group
()
{
return
$this
->
hasOne
(
'App\Models\Group'
,
'id'
,
'
creator
_id'
);
return
$this
->
hasOne
(
'App\Models\Group'
,
'id'
,
'
group
_id'
);
}
public
function
tasks
()
...
...
app/Services/ProjectService.php
View file @
1161bafb
...
...
@@ -49,7 +49,7 @@ class ProjectService implements ProjectServiceContract
}
}
public
function
update
(
$id
,
$name
,
$creator_id
,
$owner_id
,
$group_id
,
$brief
,
$cover_img
)
public
function
update
(
$id
,
$name
,
$creator_id
,
$group_id
,
$brief
,
$cover_img
)
{
$project
=
Project
::
find
(
$id
);
...
...
@@ -57,7 +57,7 @@ class ProjectService implements ProjectServiceContract
return
false
;
}
if
(
$cover_img
==
null
){
$project
->
owner_id
=
$owner_id
;
$project
->
creator_id
=
$creator_id
;
$project
->
name
=
$name
;
$project
->
brief
=
$brief
;
...
...
@@ -67,7 +67,7 @@ class ProjectService implements ProjectServiceContract
$upload
=
new
UploadPhoto
();
$imgPath
=
$upload
->
upload
(
$cover_img
);
$project
->
owner_id
=
$owner_id
;
$project
->
creator_id
=
$creator_id
;
$project
->
name
=
$name
;
$project
->
cover_img
=
$imgPath
;
...
...
@@ -86,9 +86,6 @@ class ProjectService implements ProjectServiceContract
public
function
get
(
$project_id
)
{
$project
=
Project
::
find
(
$project_id
);
if
(
$project
==
null
){
return
null
;
}
else
{
...
...
@@ -96,10 +93,10 @@ class ProjectService implements ProjectServiceContract
}
}
public
function
getAll
()
public
function
getAll
(
$group_id
)
{
$projects
=
Project
::
all
()
;
if
(
$projects
==
null
){
$projects
=
Group
::
find
(
$group_id
)
->
project
;
if
(
$projects
->
isEmpty
()
){
return
null
;
}
else
{
return
$projects
;
...
...
@@ -108,88 +105,6 @@ class ProjectService implements ProjectServiceContract
public
function
addTask
(
$name
,
$project_id
,
$creator_id
,
$owner_id
,
$status
,
$brief
,
$starts_at
,
$ends_at
)
{
$task
=
new
Task
();
$task
->
name
=
$name
;
$task
->
project_id
=
$project_id
;
$task
->
creator_id
=
$creator_id
;
$task
->
owner_id
=
$owner_id
;
$task
->
status
=
$status
;
$task
->
brief
=
$brief
;
$task
->
starts_at
=
$starts_at
;
$task
->
ends_at
=
$ends_at
;
$result
=
$task
->
save
();
if
(
$result
){
return
true
;
}
else
{
return
false
;
}
}
public
function
deleteTask
(
$id
)
{
$task
=
Task
::
find
(
$id
);
if
(
$task
==
null
){
return
false
;
}
if
(
$task
->
delete
()){
return
true
;
}
else
{
return
false
;
}
}
public
function
updateTask
(
$id
,
$name
,
$project_id
,
$creator_id
,
$owner_id
,
$status
,
$brief
,
$starts_at
,
$ends_at
)
{
$task
=
Task
::
find
(
$id
);
if
(
$task
==
null
){
return
false
;
}
$task
->
name
=
$name
;
$task
->
project_id
=
$project_id
;
$task
->
creator_id
=
$creator_id
;
$task
->
owner_id
=
$owner_id
;
$task
->
status
=
$status
;
$task
->
brief
=
$brief
;
$task
->
starts_at
=
$starts_at
;
$task
->
ends_at
=
$ends_at
;
$result
=
$task
->
update
();
if
(
$result
){
return
true
;
}
else
{
return
false
;
}
}
public
function
getTask
(
$id
)
{
$task
=
Task
::
find
(
$id
);
if
(
$task
==
null
){
return
null
;
}
else
{
return
$task
;
}
}
public
function
getAllTask
()
{
$tasks
=
Task
::
all
();
if
(
$tasks
==
null
){
return
null
;
}
else
{
return
$tasks
;
}
}
public
function
simpleSearch
(
$id
,
$content
,
$item
)
{
...
...
resources/views/admin/project/projectinformation.blade.php
View file @
1161bafb
...
...
@@ -60,38 +60,7 @@
<
h3
class
=
"box-title"
>
关于项目
</
h3
>
</
div
>
<!--
/.
box
-
header
-->
<
div
class
=
"box-body"
>
<
strong
><
i
class
=
"fa fa-book margin-r-5"
></
i
>
Education
</
strong
>
<
p
class
=
"text-muted"
>
B
.
S
.
in
Computer
Science
from
the
University
of
Tennessee
at
Knoxville
</
p
>
<
hr
>
<
strong
><
i
class
=
"fa fa-map-marker margin-r-5"
></
i
>
Location
</
strong
>
<
p
class
=
"text-muted"
>
Malibu
,
California
</
p
>
<
hr
>
<
strong
><
i
class
=
"fa fa-pencil margin-r-5"
></
i
>
Skills
</
strong
>
<
p
>
<
span
class
=
"label label-danger"
>
UI
Design
</
span
>
<
span
class
=
"label label-success"
>
Coding
</
span
>
<
span
class
=
"label label-info"
>
Javascript
</
span
>
<
span
class
=
"label label-warning"
>
PHP
</
span
>
<
span
class
=
"label label-primary"
>
Node
.
js
</
span
>
</
p
>
<
hr
>
<
strong
><
i
class
=
"fa fa-file-text-o margin-r-5"
></
i
>
Notes
</
strong
>
<
p
>
Lorem
ipsum
dolor
sit
amet
,
consectetur
adipiscing
elit
.
Etiam
fermentum
enim
neque
.</
p
>
</
div
>
<!--
/.
box
-
body
-->
</
div
>
<!--
/.
box
-->
</
div
>
...
...
@@ -100,21 +69,16 @@
<
div
class
=
"nav-tabs-custom"
>
<
ul
class
=
"nav nav-tabs"
>
<
li
class
=
"active"
><
a
href
=
"#activity"
data
-
toggle
=
"tab"
>
任务
</
a
></
li
>
<
li
><
a
href
=
"#timeline"
data
-
toggle
=
"tab"
>
Timeline
</
a
></
li
>
<
li
><
a
href
=
"#settings"
data
-
toggle
=
"tab"
>
Settings
</
a
></
li
>
</
ul
>
<
div
class
=
"tab-content"
>
@
foreach
(
$project
->
tasks
as
$value
)
<
div
class
=
"active tab-pane"
id
=
"activity"
>
<!--
Post
-->
<
div
class
=
"post"
>
<
div
class
=
"user-block"
>
<
a
href
=
"#"
>
{{
$value
[
'name'
]}}
</
a
>
<
span
class
=
"description"
>
开始时间
:
{{
$value
[
'starts_at'
]}}
</
span
>
<
span
class
=
"description"
>
结束时间
:
{{
$value
[
'ends_at'
]}}
</
span
>
<
span
class
=
"description"
>
任务简介
:
{{
$value
[
'brief'
]}}
</
span
>
...
...
@@ -130,8 +94,8 @@
<
li
><
a
href
=
"#"
class
=
"link-black text-sm"
><
i
class
=
"fa fa-thumbs-o-up margin-r-5"
></
i
>
Like
</
a
>
</
li
>
<
li
class
=
"pull-right"
>
<
a
href
=
"#"
class
=
"link-black text-sm"
><
i
class
=
"fa fa-comments-o margin-r-5"
></
i
>
Comments
(
5
)
</
a
></
li
>
{{
--<
a
href
=
"#"
class
=
"link-black text-sm"
><
i
class
=
"fa fa-comments-o margin-r-5"
></
i
>
Comments
--
}}
{{
--
(
5
)
</
a
></
li
>--
}}
</
ul
>
<
hr
>
...
...
@@ -143,158 +107,6 @@
</
div
>
@
endforeach
<!--
/.
tab
-
pane
-->
<
div
class
=
"tab-pane"
id
=
"timeline"
>
<!--
The
timeline
-->
<
ul
class
=
"timeline timeline-inverse"
>
<!--
timeline
time
label
-->
<
li
class
=
"time-label"
>
<
span
class
=
"bg-red"
>
10
Feb
.
2014
</
span
>
</
li
>
<!--
/.
timeline
-
label
-->
<!--
timeline
item
-->
<
li
>
<
i
class
=
"fa fa-envelope bg-blue"
></
i
>
<
div
class
=
"timeline-item"
>
<
span
class
=
"time"
><
i
class
=
"fa fa-clock-o"
></
i
>
12
:
05
</
span
>
<
h3
class
=
"timeline-header"
><
a
href
=
"#"
>
Support
Team
</
a
>
sent
you
an
email
</
h3
>
<
div
class
=
"timeline-body"
>
Etsy
doostang
zoodles
disqus
groupon
greplin
oooj
voxy
zoodles
,
weebly
ning
heekya
handango
imeem
plugg
dopplr
jibjab
,
movity
jajah
plickers
sifteo
edmodo
ifttt
zimbra
.
Babblely
odeo
kaboodle
quora
plaxo
ideeli
hulu
weebly
balihoo
...
</
div
>
<
div
class
=
"timeline-footer"
>
<
a
class
=
"btn btn-primary btn-xs"
>
Read
more
</
a
>
<
a
class
=
"btn btn-danger btn-xs"
>
Delete
</
a
>
</
div
>
</
div
>
</
li
>
<!--
END
timeline
item
-->
<!--
timeline
item
-->
<
li
>
<
i
class
=
"fa fa-user bg-aqua"
></
i
>
<
div
class
=
"timeline-item"
>
<
span
class
=
"time"
><
i
class
=
"fa fa-clock-o"
></
i
>
5
mins
ago
</
span
>
<
h3
class
=
"timeline-header no-border"
><
a
href
=
"#"
>
Sarah
Young
</
a
>
accepted
your
friend
request
</
h3
>
</
div
>
</
li
>
<!--
END
timeline
item
-->
<!--
timeline
item
-->
<
li
>
<
i
class
=
"fa fa-comments bg-yellow"
></
i
>
<
div
class
=
"timeline-item"
>
<
span
class
=
"time"
><
i
class
=
"fa fa-clock-o"
></
i
>
27
mins
ago
</
span
>
<
h3
class
=
"timeline-header"
><
a
href
=
"#"
>
Jay
White
</
a
>
commented
on
your
post
</
h3
>
<
div
class
=
"timeline-body"
>
Take
me
to
your
leader
!
Switzerland
is
small
and
neutral
!
We
are
more
like
Germany
,
ambitious
and
misunderstood
!
</
div
>
<
div
class
=
"timeline-footer"
>
<
a
class
=
"btn btn-warning btn-flat btn-xs"
>
View
comment
</
a
>
</
div
>
</
div
>
</
li
>
<!--
END
timeline
item
-->
<!--
timeline
time
label
-->
<
li
class
=
"time-label"
>
<
span
class
=
"bg-green"
>
3
Jan
.
2014
</
span
>
</
li
>
<!--
/.
timeline
-
label
-->
<!--
timeline
item
-->
<
li
>
<
i
class
=
"fa fa-camera bg-purple"
></
i
>
<
div
class
=
"timeline-item"
>
<
span
class
=
"time"
><
i
class
=
"fa fa-clock-o"
></
i
>
2
days
ago
</
span
>
<
h3
class
=
"timeline-header"
><
a
href
=
"#"
>
Mina
Lee
</
a
>
uploaded
new
photos
</
h3
>
<
div
class
=
"timeline-body"
>
<
img
src
=
"http://placehold.it/150x100"
alt
=
"..."
class
=
"margin"
>
<
img
src
=
"http://placehold.it/150x100"
alt
=
"..."
class
=
"margin"
>
<
img
src
=
"http://placehold.it/150x100"
alt
=
"..."
class
=
"margin"
>
<
img
src
=
"http://placehold.it/150x100"
alt
=
"..."
class
=
"margin"
>
</
div
>
</
div
>
</
li
>
<!--
END
timeline
item
-->
<
li
>
<
i
class
=
"fa fa-clock-o bg-gray"
></
i
>
</
li
>
</
ul
>
</
div
>
<!--
/.
tab
-
pane
-->
<
div
class
=
"tab-pane"
id
=
"settings"
>
<
form
class
=
"form-horizontal"
>
<
div
class
=
"form-group"
>
<
label
for
=
"inputName"
class
=
"col-sm-2 control-label"
>
Name
</
label
>
<
div
class
=
"col-sm-10"
>
<
input
type
=
"email"
class
=
"form-control"
id
=
"inputName"
placeholder
=
"Name"
>
</
div
>
</
div
>
<
div
class
=
"form-group"
>
<
label
for
=
"inputEmail"
class
=
"col-sm-2 control-label"
>
Email
</
label
>
<
div
class
=
"col-sm-10"
>
<
input
type
=
"email"
class
=
"form-control"
id
=
"inputEmail"
placeholder
=
"Email"
>
</
div
>
</
div
>
<
div
class
=
"form-group"
>
<
label
for
=
"inputName"
class
=
"col-sm-2 control-label"
>
Name
</
label
>
<
div
class
=
"col-sm-10"
>
<
input
type
=
"text"
class
=
"form-control"
id
=
"inputName"
placeholder
=
"Name"
>
</
div
>
</
div
>
<
div
class
=
"form-group"
>
<
label
for
=
"inputExperience"
class
=
"col-sm-2 control-label"
>
Experience
</
label
>
<
div
class
=
"col-sm-10"
>
<
textarea
class
=
"form-control"
id
=
"inputExperience"
placeholder
=
"Experience"
></
textarea
>
</
div
>
</
div
>
<
div
class
=
"form-group"
>
<
label
for
=
"inputSkills"
class
=
"col-sm-2 control-label"
>
Skills
</
label
>
<
div
class
=
"col-sm-10"
>
<
input
type
=
"text"
class
=
"form-control"
id
=
"inputSkills"
placeholder
=
"Skills"
>
</
div
>
</
div
>
<
div
class
=
"form-group"
>
<
div
class
=
"col-sm-offset-2 col-sm-10"
>
<
div
class
=
"checkbox"
>
<
label
>
<
input
type
=
"checkbox"
>
I
agree
to
the
<
a
href
=
"#"
>
terms
and
conditions
</
a
>
</
label
>
</
div
>
</
div
>
</
div
>
<
div
class
=
"form-group"
>
<
div
class
=
"col-sm-offset-2 col-sm-10"
>
<
button
type
=
"submit"
class
=
"btn btn-danger"
>
Submit
</
button
>
</
div
>
</
div
>
</
form
>
</
div
>
<!--
/.
tab
-
pane
-->
</
div
>
<!--
/.
tab
-
content
-->
</
div
>
<!--
/.
nav
-
tabs
-
custom
-->
...
...
resources/views/admin/project/update.blade.php
View file @
1161bafb
...
...
@@ -24,18 +24,18 @@
</
div
>
<
div
class
=
"form-group"
>
<
label
for
=
"exampleInputEmail1"
>
项目名称
</
label
>
<
input
type
=
"text"
class
=
"form-control"
id
=
"exampleInputEmail1"
placeholder
=
"User_email"
name
=
"name"
value
=
"
{
{$result['name']}
}
"
>
<
input
type
=
"text"
class
=
"form-control"
id
=
"exampleInputEmail1"
name
=
"name"
value
=
"
{
{$result['name']}
}
"
>
<
input
type
=
"hidden"
name
=
"id"
value
=
"
{
{$result['id']}
}
"
>
<
input
type
=
"hidden"
name
=
"group_id"
value
=
"
{
{$result->group['id']}
}
"
>
</
div
>
<
div
class
=
"form-group"
>
<
label
for
=
"exampleInputEmail1"
>
项目创建者
</
label
>
<
input
type
=
"text"
class
=
"form-control"
id
=
"exampleInputEmail1"
placeholder
=
"User_email"
value
=
"
{
{$result->group['
name']}
}
"
readonly
>
<
input
type
=
"text"
class
=
"form-control"
id
=
"exampleInputEmail1"
value
=
"
{
{$result->group->creator['user_
name']}
}
"
readonly
>
<
input
type
=
"hidden"
name
=
"creator_id"
value
=
"
{
{$result['creator_id']}
}
"
>
</
div
>
<
div
class
=
"form-group"
>
<
label
for
=
"exampleInputEmail1"
>
项目拥有者
</
label
>
<
input
type
=
"text"
class
=
"form-control"
id
=
"exampleInputEmail1"
placeholder
=
"User_email"
value
=
"
{
{$result->group['
name']}
}
"
readonly
>
<
input
type
=
"text"
class
=
"form-control"
id
=
"exampleInputEmail1"
value
=
"
{
{$result->group->owner['user_
name']}
}
"
readonly
>
<
input
type
=
"hidden"
name
=
"owner_id"
value
=
"
{
{$result['owner_id']}
}
"
>
</
div
>
<
div
class
=
"form-group"
>
...
...
resources/views/admin/sidebar.blade.php
View file @
1161bafb
...
...
@@ -70,8 +70,8 @@
</span>
</a>
<ul
class=
"treeview-menu"
>
<li><a
href=
"
{{url('auth/getAll')}}
"
>
权限列表
</a></li>
<li><a
href=
"
{{url('auth/add')}}
"
>
新增权限
</a></li>
<li><a
href=
"
#
"
>
权限列表
</a></li>
<li><a
href=
"
#
"
>
新增权限
</a></li>
{{--
<li><a
href=
"#"
>
Link in level 2
</a></li>
--}}
</ul>
...
...
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