<?php

namespace Feature\Lib;

use Dever;

class Info
{
    # 根据文章id 获取文章信息
    public function get($data, $uid = false)
    {
        if (!is_array($data)) {
            $data = Dever::db('feature/info')->getOne($data);
        }
        
        if (!$data) {
            Dever::alert('错误的专题信息');
        }
    
        $data = Dever::load('content/lib/article')->getContent($data, $uid);

        return $data;
    }

    # 获取相关推荐
    public function getRelation($info)
    {
        $where['noid'] = $info['id'];
        $where['cate_id'] = $info['cate_id'];
        return Dever::db('feature/info')->getRelation($where);
    }

    # 增加浏览量
    public function addView($id)
    {
        Dever::db('feature/info')->addView($id);
    }
}