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
1b5fc47f
Commit
1b5fc47f
authored
May 25, 2020
by
huanle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
0525.model/Doclist.php
parent
d3c8271e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
38 deletions
+46
-38
Doclist.php
application/api/model/Doclist.php
+46
-38
No files found.
application/api/model/Doclist.php
View file @
1b5fc47f
...
@@ -16,72 +16,79 @@ class Doclist extends Model
...
@@ -16,72 +16,79 @@ class Doclist extends Model
}
}
//获取文件夹名称
//获取文件夹名称
public
function
A
rticleList
(
$folderid
,
$origin
,
$pagenum
)
public
function
a
rticleList
(
$folderid
,
$origin
,
$pagenum
)
{
{
var_dump
(
$origin
);
var_dump
(
$pagenum
);
die
();
$where
=
[
'folderid'
=>
$folderid
];
$where
=
[
'folderid'
=>
$folderid
];
$articlelist
=
Db
::
name
(
'doclist'
)
->
where
(
$where
)
->
order
(
''
)
->
select
();
$articlelist
=
Db
::
name
(
'doclist'
)
->
field
(
'docid,title,type,updatetime'
)
->
where
(
$where
)
->
order
(
'createtime'
)
->
limit
(
$origin
,
$pagenum
)
->
select
();
$sql
=
Db
::
name
(
'doclist'
)
->
getLastSql
();
//
$sql = Db::name('doclist')->getLastSql();
var_dump
(
$sql
);
//
var_dump($sql);
return
$articlelist
;
return
$articlelist
;
}
}
public
function
addFolder
(
$name
,
$parentid
)
public
function
articleDetail
(
$docid
)
{
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
)
{
{
$folderid
=
randomkeys
(
18
);
$docid
=
randomkeys
(
18
);
// $where = ['folderid' => $folderid];
$docname
=
Db
::
name
(
'doclist'
)
->
where
([
'docid'
=>
$docid
])
->
count
();
$foldername
=
Db
::
name
(
'folder'
)
->
where
([
'folderid'
=>
$folderid
])
->
count
();
$rs
=
new
Doclist
();
$rs
=
new
Doclist
();
if
(
$
folder
name
==
0
)
{
if
(
$
doc
name
==
0
)
{
$data
=
[
$data
=
[
'docid'
=>
$docid
,
'title'
=>
$title
,
'type'
=>
$type
,
'doc'
=>
$doc
,
'folderid'
=>
$folderid
,
'folderid'
=>
$folderid
,
'name'
=>
$name
,
'createtime'
=>
date
(
"Y-m-d H:i:s"
,
time
())
'updatetime'
=>
date
(
"Y-m-d H:i:s"
,
time
()),
'parentid'
=>
$parentid
,
'state'
=>
0
];
];
$rs
->
isUpdate
(
false
)
->
save
(
$data
);
$rs
->
isUpdate
(
false
)
->
save
(
$data
);
$return
=
$rs
->
folderid
;
// $sql = Db::name('doclist')->getLastSql();
// var_dump($sql);
$return
=
$rs
->
docid
;
return
$return
;
return
$return
;
}
}
}
}
public
function
editArticle
(
$title
,
$folderid
,
$doc
,
$docid
)
public
function
editFolder
(
$name
,
$parentid
,
$folderid
)
{
{
$rs
=
new
Folder
();
$rs
=
new
Doclist
();
$where
=
''
;
$where
=
[]
;
$data
=
[
$data
=
[
'name'
=>
$name
,
'title'
=>
$title
,
'doc'
=>
$doc
,
'updatetime'
=>
date
(
"Y-m-d H:i:s"
,
time
()),
'updatetime'
=>
date
(
"Y-m-d H:i:s"
,
time
()),
];
];
if
(
$folderid
)
{
$where
=
[
'folderid'
=>
$folderid
];
if
(
$docid
)
{
$where
[
'docid'
]
=
array
(
'='
,
$docid
);
$where
[
'folderid'
]
=
array
(
'='
,
$folderid
);
}
}
if
(
$parentid
)
{
$where
=
[
'parentid'
=>
$parentid
];
}
$oldname
=
Db
::
name
(
'folder'
)
->
where
(
$where
)
->
value
(
'name'
);
if
(
$name
!=
$oldname
)
{
$rs
=
$this
->
where
(
$where
)
->
update
(
$data
);
$rs
=
$this
->
where
(
$where
)
->
update
(
$data
);
if
(
$rs
===
false
)
{
if
(
$rs
===
false
)
{
return
false
;
return
false
;
}
else
{
}
else
{
return
true
;
return
true
;
}
}
}
else
{
return
false
;
}
// var_dump($rs);die();
// var_dump($rs);die();
...
@@ -90,12 +97,13 @@ class Doclist extends Model
...
@@ -90,12 +97,13 @@ class Doclist extends Model
}
}
public
function
del
Folder
(
$folder
id
)
public
function
del
Article
(
$doc
id
)
{
{
$rs
=
new
Folder
();
$rs
=
new
Doclist
();
$where
=
[
'
folderid'
=>
$folder
id
];
$where
=
[
'
docid'
=>
$doc
id
];
$data
=
[
$data
=
[
'state'
=>
-
1
,
'state'
=>
-
1
,
'updatetime'
=>
date
(
"Y-m-d H:i:s"
,
time
())
];
];
$rs
=
$this
->
where
(
$where
)
->
update
(
$data
);
$rs
=
$this
->
where
(
$where
)
->
update
(
$data
);
...
...
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