|
|
@@ -35,17 +35,23 @@ class Api
|
|
|
# 获取合集下的分类
|
|
|
public function category()
|
|
|
{
|
|
|
+ $parent_page = Dever::input('parent_page');
|
|
|
+ $page = Dever::input('page');
|
|
|
$where['info_id'] = Dever::input('id');
|
|
|
$data['cate'] = Dever::db('collection/page')->main($where);
|
|
|
if ($data['cate']) {
|
|
|
$data['child'] = Dever::db('collection/page')->child($where);
|
|
|
$content = Dever::db('collection/content')->child($where);
|
|
|
- foreach ($data['child'] as $k => $v) {
|
|
|
- if ($k == 0) {
|
|
|
- $data['child'][$k]['show'] = 1;
|
|
|
+ $data['show'] = array();
|
|
|
+ foreach ($data['cate'] as $k => $v) {
|
|
|
+ if ($v['id'] == $parent_page) {
|
|
|
+ $data['show'][$v['id']] = 1;
|
|
|
} else {
|
|
|
- $data['child'][$k]['show'] = 2;
|
|
|
+ $data['show'][$v['id']] = 2;
|
|
|
}
|
|
|
+ }
|
|
|
+ foreach ($data['child'] as $k => $v) {
|
|
|
+
|
|
|
if (isset($content[$v['id']])) {
|
|
|
$data['child'][$k]['content'] = $content[$v['id']];
|
|
|
}
|