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
Expand all
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;
...
@@ -11,21 +11,15 @@ namespace App\Contracts;
interface
ProjectServiceContract
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
...
@@ -21,25 +21,26 @@ class ProjectController extends Controller
{
{
$projectid
=
$request
->
id
;
$projectid
=
$request
->
id
;
$project
=
$this
->
mProject
->
get
(
$projectid
);
$project
=
$this
->
mProject
->
get
(
$projectid
);
if
(
project
){
if
(
count
(
$project
)
>
0
){
return
view
(
'admin/project/projectinformation'
,
compact
(
'project'
));
return
view
(
'admin/project/projectinformation'
,
compact
(
'project'
));
}
else
{
echo
'项目查不到!'
;
return
back
();
}
}
}
}
// 查看团队所有项目
public
function
getAll
(
Request
$request
)
public
function
getAll
(
Request
$request
)
{
{
$groupid
=
$request
->
id
;
$groupId
=
$request
->
id
;
$projects
=
$this
->
mProject
->
getAll
(
$groupId
);
$projects
=
Group
::
find
(
$groupid
)
->
project
;
if
(
$projects
){
if
(
count
(
$projects
)
>
0
){
return
view
(
'admin/project/projecttables'
,
compact
(
'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
...
@@ -48,12 +49,12 @@ class ProjectController extends Controller
{
{
$projectid
=
$request
->
id
;
$projectid
=
$request
->
id
;
$project
=
$this
->
mProject
->
get
(
$projectid
);
$project
=
$this
->
mProject
->
get
(
$projectid
);
$result
=
$project
;
$result
=
$project
;
if
(
count
(
$project
)
>
0
){
if
(
$project
){
return
view
(
'admin/project/update'
,
compact
(
'result'
));
return
view
(
'admin/project/update'
,
compact
(
'result'
));
}
}
echo
'没有此项目!'
;
return
back
();
return
Message
::
makeError
(
'错误'
);
return
Message
::
makeError
(
'错误'
);
}
}
...
@@ -63,16 +64,17 @@ class ProjectController extends Controller
...
@@ -63,16 +64,17 @@ class ProjectController extends Controller
$id
=
$request
->
id
;
$id
=
$request
->
id
;
$name
=
$request
->
name
;
$name
=
$request
->
name
;
$cover_img
=
$request
->
cover_img
;
$cover_img
=
$request
->
cover_img
;
$owner_id
=
$request
->
owner_id
;
$creator_id
=
$request
->
creator_id
;
$creator_id
=
$request
->
creator_id
;
$group_id
=
$request
->
group_id
;
$group_id
=
$request
->
group_id
;
$brief
=
$request
->
brief
;
$brief
=
$request
->
brief
;
$project
=
$this
->
mProject
->
update
(
$id
,
$name
,
$creator_id
,
$group_id
,
$brief
,
$cover_img
);
$project
=
$this
->
mProject
->
update
(
$id
,
$name
,
$creator_id
,
$owner_id
,
$group_id
,
$brief
,
$cover_img
);
if
(
$project
){
if
(
$project
){
return
back
();
return
back
();
}
}
echo
'修改项目失败!'
;
return
back
();
}
}
...
...
app/Http/Controllers/UserController.php
View file @
1161bafb
...
@@ -55,7 +55,6 @@ class UserController extends Controller
...
@@ -55,7 +55,6 @@ class UserController extends Controller
if
(
$head_icon
==
null
){
if
(
$head_icon
==
null
){
$head_icon
=
null
;
$head_icon
=
null
;
}
}
$result
=
$this
->
mUser
->
update
(
$id
,
$phone
,
$user_name
,
$real_name
,
$gender
,
$email
,
$head_icon
);
$result
=
$this
->
mUser
->
update
(
$id
,
$phone
,
$user_name
,
$real_name
,
$gender
,
$email
,
$head_icon
);
if
(
$result
){
if
(
$result
){
...
...
app/Models/Group.php
View file @
1161bafb
...
@@ -28,6 +28,6 @@ class Group extends Model
...
@@ -28,6 +28,6 @@ class Group extends Model
public
function
project
()
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
...
@@ -13,7 +13,7 @@ class Project extends Model
public
function
group
()
public
function
group
()
{
{
return
$this
->
hasOne
(
'App\Models\Group'
,
'id'
,
'
creator
_id'
);
return
$this
->
hasOne
(
'App\Models\Group'
,
'id'
,
'
group
_id'
);
}
}
public
function
tasks
()
public
function
tasks
()
...
...
app/Services/ProjectService.php
View file @
1161bafb
...
@@ -49,7 +49,7 @@ class ProjectService implements ProjectServiceContract
...
@@ -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
);
$project
=
Project
::
find
(
$id
);
...
@@ -57,7 +57,7 @@ class ProjectService implements ProjectServiceContract
...
@@ -57,7 +57,7 @@ class ProjectService implements ProjectServiceContract
return
false
;
return
false
;
}
}
if
(
$cover_img
==
null
){
if
(
$cover_img
==
null
){
$project
->
owner_id
=
$owner_id
;
$project
->
creator_id
=
$creator_id
;
$project
->
creator_id
=
$creator_id
;
$project
->
name
=
$name
;
$project
->
name
=
$name
;
$project
->
brief
=
$brief
;
$project
->
brief
=
$brief
;
...
@@ -67,7 +67,7 @@ class ProjectService implements ProjectServiceContract
...
@@ -67,7 +67,7 @@ class ProjectService implements ProjectServiceContract
$upload
=
new
UploadPhoto
();
$upload
=
new
UploadPhoto
();
$imgPath
=
$upload
->
upload
(
$cover_img
);
$imgPath
=
$upload
->
upload
(
$cover_img
);
$project
->
owner_id
=
$owner_id
;
$project
->
creator_id
=
$creator_id
;
$project
->
creator_id
=
$creator_id
;
$project
->
name
=
$name
;
$project
->
name
=
$name
;
$project
->
cover_img
=
$imgPath
;
$project
->
cover_img
=
$imgPath
;
...
@@ -86,9 +86,6 @@ class ProjectService implements ProjectServiceContract
...
@@ -86,9 +86,6 @@ class ProjectService implements ProjectServiceContract
public
function
get
(
$project_id
)
public
function
get
(
$project_id
)
{
{
$project
=
Project
::
find
(
$project_id
);
$project
=
Project
::
find
(
$project_id
);
if
(
$project
==
null
){
if
(
$project
==
null
){
return
null
;
return
null
;
}
else
{
}
else
{
...
@@ -96,10 +93,10 @@ class ProjectService implements ProjectServiceContract
...
@@ -96,10 +93,10 @@ class ProjectService implements ProjectServiceContract
}
}
}
}
public
function
getAll
()
public
function
getAll
(
$group_id
)
{
{
$projects
=
Project
::
all
()
;
$projects
=
Group
::
find
(
$group_id
)
->
project
;
if
(
$projects
==
null
){
if
(
$projects
->
isEmpty
()
){
return
null
;
return
null
;
}
else
{
}
else
{
return
$projects
;
return
$projects
;
...
@@ -108,88 +105,6 @@ class ProjectService implements ProjectServiceContract
...
@@ -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
)
public
function
simpleSearch
(
$id
,
$content
,
$item
)
{
{
...
...
resources/views/admin/project/projectinformation.blade.php
View file @
1161bafb
This diff is collapsed.
Click to expand it.
resources/views/admin/project/update.blade.php
View file @
1161bafb
...
@@ -24,18 +24,18 @@
...
@@ -24,18 +24,18 @@
</
div
>
</
div
>
<
div
class
=
"form-group"
>
<
div
class
=
"form-group"
>
<
label
for
=
"exampleInputEmail1"
>
项目名称
</
label
>
<
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
=
"id"
value
=
"
{
{$result['id']}
}
"
>
<
input
type
=
"hidden"
name
=
"group_id"
value
=
"
{
{$result->group['id']}
}
"
>
<
input
type
=
"hidden"
name
=
"group_id"
value
=
"
{
{$result->group['id']}
}
"
>
</
div
>
</
div
>
<
div
class
=
"form-group"
>
<
div
class
=
"form-group"
>
<
label
for
=
"exampleInputEmail1"
>
项目创建者
</
label
>
<
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']}
}
"
>
<
input
type
=
"hidden"
name
=
"creator_id"
value
=
"
{
{$result['creator_id']}
}
"
>
</
div
>
</
div
>
<
div
class
=
"form-group"
>
<
div
class
=
"form-group"
>
<
label
for
=
"exampleInputEmail1"
>
项目拥有者
</
label
>
<
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']}
}
"
>
<
input
type
=
"hidden"
name
=
"owner_id"
value
=
"
{
{$result['owner_id']}
}
"
>
</
div
>
</
div
>
<
div
class
=
"form-group"
>
<
div
class
=
"form-group"
>
...
...
resources/views/admin/sidebar.blade.php
View file @
1161bafb
...
@@ -70,8 +70,8 @@
...
@@ -70,8 +70,8 @@
</span>
</span>
</a>
</a>
<ul
class=
"treeview-menu"
>
<ul
class=
"treeview-menu"
>
<li><a
href=
"
{{url('auth/getAll')}}
"
>
权限列表
</a></li>
<li><a
href=
"
#
"
>
权限列表
</a></li>
<li><a
href=
"
{{url('auth/add')}}
"
>
新增权限
</a></li>
<li><a
href=
"
#
"
>
新增权限
</a></li>
{{--
<li><a
href=
"#"
>
Link in level 2
</a></li>
--}}
{{--
<li><a
href=
"#"
>
Link in level 2
</a></li>
--}}
</ul>
</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