dever 5 年之前
父節點
當前提交
0a05283016
共有 1 個文件被更改,包括 44 次插入0 次删除
  1. 44 0
      app/community/src/Api.php

+ 44 - 0
app/community/src/Api.php

@@ -0,0 +1,44 @@
+<?php
+
+namespace Community\Src;
+
+use Dever;
+
+class Api
+{
+    # 获取社区下的分类
+    public function category()
+    {
+    	$info_id = Dever::input('info_id');
+    	$page_id = Dever::input('page_id');
+        $content_id = Dever::input('content_id');
+
+    	# 之后要通过合集id获取名字
+        $data['cate'] = Dever::db('community/cate')->getAll();
+        return $data;
+    }
+
+    # 获取社区下的帖子
+    public function info()
+    {
+    	# 获取分类下的帖子
+    	$where['cate_id'] = Dever::input('cate_id');
+        $where['type'] = Dever::input('type', 3);
+        $where['type_id'] = Dever::input('type_id', 1);
+        $data['info'] = Dever::db('community/info')->getAll($where);
+    	if ($data['info']) {
+    		foreach ($data['info'] as $k => $v) {
+    			$data['info'][$k] = $this->one($v);
+    		}
+    	}
+
+        return $data;
+    }
+
+    private function one($info)
+    {
+    	$info['pic'] = explode(',', $info['pic']);
+
+    	return $info;
+    }
+}