dever %!s(int64=5) %!d(string=hai) anos
pai
achega
0f6305c915
Modificáronse 1 ficheiros con 36 adicións e 0 borrados
  1. 36 0
      app/content/lib/News.php

+ 36 - 0
app/content/lib/News.php

@@ -0,0 +1,36 @@
+<?php
+
+namespace Content\Lib;
+
+use Dever;
+
+class News
+{
+    # 根据文章id 获取文章信息
+    public function get($data, $uid = false)
+    {
+        if (!is_array($data)) {
+            $data = Dever::db('content/news')->getOne($data);
+        }
+        
+        if (!$data) {
+            Dever::alert('错误的文章信息');
+        }
+
+        return $data;
+    }
+
+    # 获取相关推荐
+    public function getRelation($info)
+    {
+        $where['noid'] = $info['id'];
+        $where['cate_id'] = $info['cate_id'];
+        return Dever::db('content/news')->getRelation($where);
+    }
+
+    # 增加浏览量
+    public function addView($id)
+    {
+        Dever::db('content/news')->addView($id);
+    }
+}