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
e92e2603
Commit
e92e2603
authored
May 29, 2020
by
huanle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
0529 edit
parent
28d92cc0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
38 deletions
+36
-38
Index.php
application/api/controller/Index.php
+3
-3
Doclist.php
application/api/model/Doclist.php
+33
-35
No files found.
application/api/controller/Index.php
View file @
e92e2603
...
...
@@ -168,6 +168,7 @@ class Index extends Controller
return
json
(
code
([],
10002
,
'请求失败'
));
}
}
public
function
articleAdd
()
{
$title
=
input
(
'post.title'
);
...
...
@@ -196,14 +197,13 @@ class Index extends Controller
public
function
articleEdit
()
{
$title
=
input
(
'post.title'
);
$folderid
=
input
(
'post.folderid'
);
$doc
=
input
(
'post.doc'
);
$docid
=
input
(
'post.docid'
);
$model
=
new
Doclist
();
if
(
empty
(
$folderid
)
||
empty
(
$title
)
||
empty
(
$doc
)
||
empty
(
$docid
))
{
if
(
empty
(
$title
)
||
empty
(
$docid
))
{
return
json
(
code
([],
10001
,
'参数不足'
));
}
$res
=
$model
->
editArticle
(
$title
,
$
folderid
,
$
doc
,
$docid
);
$res
=
$model
->
editArticle
(
$title
,
$doc
,
$docid
);
if
(
$res
)
{
return
json
(
code
([],
0
,
'修改成功'
));
}
else
{
...
...
application/api/model/Doclist.php
View file @
e92e2603
...
...
@@ -16,20 +16,20 @@ class Doclist extends Model
}
//获取文件夹名称
public
function
articleList
(
$folderid
,
$origin
,
$pagenum
)
public
function
articleList
(
$folderid
,
$origin
,
$pagenum
)
{
// var_dump($folderid);
if
(
$folderid
)
{
$where
[
'folderid'
]
=
array
(
'='
,
$folderid
);
$where
[
'state'
]
=
array
(
'='
,
0
);
$articlelist
=
Db
::
name
(
'doclist'
)
->
field
(
'docid,title,type,updatetime'
)
->
where
(
$where
)
->
order
(
'createtime'
)
->
limit
(
$origin
,
$pagenum
)
->
select
();
if
(
$folderid
)
{
$where
[
'folderid'
]
=
array
(
'='
,
$folderid
);
$where
[
'state'
]
=
array
(
'='
,
0
);
$articlelist
=
Db
::
name
(
'doclist'
)
->
field
(
'docid,title,type,updatetime'
)
->
where
(
$where
)
->
order
(
'createtime'
)
->
limit
(
$origin
,
$pagenum
)
->
select
();
// $sql = Db::name('doclist')->getLastSql();
// var_dump($sql);
}
else
{
$articlelist
=
[];
}
}
else
{
$articlelist
=
[];
}
return
$articlelist
;
}
...
...
@@ -37,13 +37,14 @@ class Doclist extends Model
public
function
articleDetail
(
$docid
)
{
if
(
$docid
)
{
$where
=
[
'docid'
=>
$docid
];
$articldetail
=
Db
::
name
(
'doclist'
)
->
field
(
'docid,title,type,updatetime,doc'
)
->
where
(
$where
)
->
find
();
return
$articldetail
;
}
if
(
$docid
)
{
$where
=
[
'docid'
=>
$docid
];
$articldetail
=
Db
::
name
(
'doclist'
)
->
field
(
'docid,title,type,updatetime,doc'
)
->
where
(
$where
)
->
find
();
return
$articldetail
;
}
}
public
function
addArticle
(
$title
,
$folderid
,
$type
,
$doc
)
public
function
addArticle
(
$title
,
$folderid
,
$type
,
$doc
)
{
$docid
=
randomkeys
(
18
);
...
...
@@ -54,12 +55,12 @@ class Doclist extends Model
$rs
=
new
Doclist
();
if
(
$docname
==
0
)
{
$data
=
[
'docid'
=>
$docid
,
'title'
=>
$title
,
'docid'
=>
$docid
,
'title'
=>
$title
,
'type'
=>
$type
,
'doc'
=>
$doc
,
'folderid'
=>
$folderid
,
'createtime'
=>
date
(
"Y-m-d H:i:s"
,
time
())
'createtime'
=>
date
(
"Y-m-d H:i:s"
,
time
())
];
$rs
->
isUpdate
(
false
)
->
save
(
$data
);
// $sql = Db::name('doclist')->getLastSql();
...
...
@@ -71,23 +72,23 @@ class Doclist extends Model
}
public
function
editArticle
(
$title
,
$folderid
,
$doc
,
$docid
)
public
function
editArticle
(
$title
,
$doc
,
$docid
)
{
$rs
=
new
Doclist
();
$where
=
[];
$d
ata
=
[
'title'
=>
$title
,
'doc'
=>
$doc
,
'updatetime'
=>
date
(
"Y-m-d H:i:s"
,
time
())
,
];
$d
ocname
=
Db
::
name
(
'doclist'
)
->
where
([
'docid'
=>
$docid
])
->
count
();
if
(
$docname
>
0
){
$data
=
[
'title'
=>
$title
,
'doc'
=>
$doc
,
'updatetime'
=>
date
(
"Y-m-d H:i:s"
,
time
()),
if
(
$docid
)
{
$where
[
'docid'
]
=
array
(
'='
,
$docid
);
];
if
(
$docid
)
{
$where
[
'docid'
]
=
array
(
'='
,
$docid
);
}
}
$rs
=
$this
->
where
(
$where
)
->
update
(
$data
);
if
(
$rs
===
false
)
{
...
...
@@ -95,12 +96,9 @@ class Doclist extends Model
}
else
{
return
true
;
}
// var_dump($rs);die();
// $sql = Db::name('folder')->getLastSql();
// var_dump($sql);
}
else
{
return
false
;
}
}
...
...
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