Selaa lähdekoodia

增加信息接口

Jason 1 vuosi sitten
vanhempi
sitoutus
73bae98728

+ 1 - 1
application/admin/controller/news/Lists.php

@@ -21,7 +21,7 @@ class Lists extends Backend
     public function _initialize()
     {
         parent::_initialize();
-        $this->model = new \app\common\model\Lists;
+        $this->model = new \app\common\model\News;
 
     }
 

+ 1 - 1
application/admin/controller/news/Types.php

@@ -21,7 +21,7 @@ class Types extends Backend
     public function _initialize()
     {
         parent::_initialize();
-        $this->model = new \app\common\model\Types;
+        $this->model = new \app\common\model\NewsType;
 
     }
 

+ 31 - 0
application/api/controller/Index.php

@@ -5,6 +5,7 @@ namespace app\api\controller;
 use app\common\controller\Api;
 use app\common\model\Config;
 use app\common\model\Moneylog;
+use app\common\model\News;
 use app\common\model\Order as OrderModel;
 
 /**
@@ -84,4 +85,34 @@ class Index extends Api
         $res_data['team_num']   = $user['team_num'];
         $this->success('', $res_data);
     }
+
+    public function news_list()
+    {
+        $info_list = (new News())
+            ->field('img_url,content', true)
+            ->where('type_id', 2)//常见问题
+            ->order('id DESC')
+            ->paginate($this->pageSize);
+//        foreach ($info_list as $k => $v) {
+//            $paginator[$k]['status_name'] = (new OrderModel())->getStatusNames($v['status']);
+//        }
+        $res_data = $this->buildResp($info_list->total(), $info_list->currentPage(), $info_list->items());
+        $this->success('', $res_data);
+    }
+
+    public function news()
+    {
+        $news_id          = $this->request->post('id');
+        $type_id          = $this->request->post('type_id');
+        $where['type_id'] = $type_id;
+        if(!empty($news_id)){
+            $where['id']  = $news_id;
+        }
+        $info_list = (new News())
+            //->field('title,content')
+            ->where($where)
+            ->order('id desc')
+            ->find();
+        $this->success('', $info_list);
+    }
 }

+ 1 - 1
application/common/model/Lists.php → application/common/model/News.php

@@ -5,7 +5,7 @@ namespace app\common\model;
 use think\Model;
 
 
-class Lists extends Model
+class News extends Model
 {
 
     

+ 1 - 1
application/common/model/Types.php → application/common/model/NewsType.php

@@ -5,7 +5,7 @@ namespace app\common\model;
 use think\Model;
 
 
-class Types extends Model
+class NewsType extends Model
 {