|
@@ -70,7 +70,7 @@ class Community extends Api
|
|
|
return$time;
|
|
|
}
|
|
|
/**
|
|
|
- * 文档列表
|
|
|
+ * 文档概览
|
|
|
*/
|
|
|
public function document_list(){
|
|
|
$data = Document::all(function ($query){
|
|
@@ -79,7 +79,7 @@ class Community extends Api
|
|
|
$this->success('成功',$data);
|
|
|
}
|
|
|
/**
|
|
|
- * 文档详情
|
|
|
+ * 文档列表
|
|
|
* @ApiParams (name="type",description="0好柿购,1多享柿,2门柿购,3海柿购,4柿知识")
|
|
|
*/
|
|
|
public function document(){
|
|
@@ -99,7 +99,15 @@ class Community extends Api
|
|
|
case 4:
|
|
|
$where = ['belong'=>4];
|
|
|
}
|
|
|
- $data = Document::where($where)->order('weigh desc')->select();
|
|
|
+// $data = Document::where($where)
|
|
|
+// ->where(['ismenu'=>1,'pid'=>0])
|
|
|
+// ->with(['subset'=>function($query)use{
|
|
|
+//
|
|
|
+// }])
|
|
|
+// ->field('id,pid,title,weigh,ismenu')
|
|
|
+// ->order('weigh desc')
|
|
|
+// ->select();
|
|
|
+ $data = Document::where($where)->field('id,pid,title,weigh,ismenu,belong')->order('weigh desc')->select();
|
|
|
$res = [];
|
|
|
foreach ($data as $k=>$v){
|
|
|
array_push($res,$v->toarray());
|
|
@@ -107,7 +115,6 @@ class Community extends Api
|
|
|
$list = $this->getTree($res,'id','pid','children');
|
|
|
$this->success('返回成功', $list);
|
|
|
}
|
|
|
-
|
|
|
/**
|
|
|
* 树形化
|
|
|
* @param $arr
|
|
@@ -134,7 +141,13 @@ class Community extends Api
|
|
|
}
|
|
|
return $tree;
|
|
|
}
|
|
|
- //
|
|
|
+ /**
|
|
|
+ * 文档详情
|
|
|
+ * @ApiParams (name="id",description="")
|
|
|
+ */
|
|
|
+ public function document_details(){
|
|
|
+ $this->success('成功',Document::where(['id'=>$this->request->post('id')])->value('content'));
|
|
|
+ }
|
|
|
/**
|
|
|
* 成为合作伙伴
|
|
|
* @ApiParams (name="token")
|