Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
doc_phone
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jiangyipeng
doc_phone
Commits
c53b675c
Commit
c53b675c
authored
May 29, 2020
by
huanle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
0529—
parent
5694ea23
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
+16
-6
Index.php
application/api/controller/Index.php
+10
-4
Folder.php
application/api/model/Folder.php
+6
-2
No files found.
application/api/controller/Index.php
View file @
c53b675c
...
@@ -52,11 +52,17 @@ class Index extends Controller
...
@@ -52,11 +52,17 @@ class Index extends Controller
}
else
{
}
else
{
$res
=
$model
->
addFolder
(
$name
,
$parentid
);
$res
=
$model
->
addFolder
(
$name
,
$parentid
);
if
(
$res
[
'code'
]
>
=
0
)
{
if
(
$res
[
'code'
]
=
=
0
)
{
return
json
(
code
([],
0
,
'添加成功'
));
return
json
(
code
([
$res
[
'data'
]],
0
,
'添加成功'
));
}
else
{
}
return
json
(
code
([],
10002
,
'添加失败'
));
if
(
$res
[
'code'
]
==-
200
)
{
return
json
(
code
([],
0
,
'文件名重复'
));
}
if
(
$res
[
'code'
]
==-
10002
)
{
return
json
(
code
([],
0
,
'添加失败'
));
}
}
}
}
}
}
...
...
application/api/model/Folder.php
View file @
c53b675c
...
@@ -75,13 +75,15 @@ class Folder extends Model
...
@@ -75,13 +75,15 @@ class Folder extends Model
if
(
$parentid
)
{
if
(
$parentid
)
{
$items
=
$this
->
where
([
'folderid'
=>
$parentid
])
->
setField
(
'items'
,
$childfolder_nums
+
1
);
$items
=
$this
->
where
([
'folderid'
=>
$parentid
])
->
setField
(
'items'
,
$childfolder_nums
+
1
);
if
(
$items
)
{
if
(
$items
)
{
$return
=
$rs
->
folderid
;
$folderid
=
$rs
->
folderid
;
$return
=
[
'code'
=>
0
,
'msg'
=>
'添加成功'
,
'data'
=>
$folderid
];
}
else
{
}
else
{
throw
new
\Exception
(
'添加失败'
);
throw
new
\Exception
(
'添加失败'
);
}
}
}
else
{
}
else
{
$return
=
$rs
->
folderid
;
$folderid
=
$rs
->
folderid
;
$return
=
[
'code'
=>
0
,
'msg'
=>
'添加成功'
,
'data'
=>
$folderid
];
}
}
}
}
// 提交事务
// 提交事务
...
@@ -90,10 +92,12 @@ class Folder extends Model
...
@@ -90,10 +92,12 @@ class Folder extends Model
// 回滚事务
// 回滚事务
Db
::
rollback
();
Db
::
rollback
();
$return
=
[
'code'
=>
-
200
,
'msg'
=>
$e
->
getMessage
()];
$return
=
[
'code'
=>
-
200
,
'msg'
=>
$e
->
getMessage
()];
}
}
}
else
{
}
else
{
$return
=
[
'code'
=>
-
10002
,
'msg'
=>
'文件名重复'
];
$return
=
[
'code'
=>
-
10002
,
'msg'
=>
'文件名重复'
];
}
}
return
$return
;
return
$return
;
...
...
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