Commit 48e78d4b authored by huanle's avatar huanle

0525 2:12

parent 1c7f4818
......@@ -9,26 +9,26 @@ class Doclist extends Model
{
public function index()
{
$user = Db::name('folder')->where('state', '=', -1)->find();
return $user;
// $user = Db::name('folder')->where('state', '=', -1)->find();
// return $user;
// $sql = Db::name('folder')->getLastSql();
//// var_dump($sql);
}
//获取文件夹名称
public function articleList($folderid,$origin,$pagenum)
public function articleList($folderid, $origin, $pagenum)
{
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);
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){
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,8 +55,8 @@ 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,
......@@ -70,7 +71,8 @@ class Doclist extends Model
}
public function editArticle($title, $folderid,$doc,$docid)
public function editArticle($title, $folderid, $doc, $docid)
{
$rs = new Doclist();
......@@ -78,14 +80,14 @@ class Doclist extends Model
$where = [];
$data = [
'title' => $title,
'doc' =>$doc,
'doc' => $doc,
'updatetime' => date("Y-m-d H:i:s", time()),
];
if ($docid) {
$where['docid'] = array('=',$docid);
$where['folderid'] = array('=',$folderid);
$where['docid'] = array('=', $docid);
$where['folderid'] = array('=', $folderid);
}
$rs = $this->where($where)->update($data);
......@@ -96,7 +98,6 @@ class Doclist extends Model
}
// var_dump($rs);die();
// $sql = Db::name('folder')->getLastSql();
// var_dump($sql);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment