xieruidong 2 years ago
parent
commit
8d75eda9e1
3 changed files with 61 additions and 1 deletions
  1. 60 0
      app/data/controller/api/ResCenter.php
  2. 0 1
      app/data/controller/api/Xw.php
  3. 1 0
      config/apidoc.php

+ 60 - 0
app/data/controller/api/ResCenter.php

@@ -0,0 +1,60 @@
+<?php
+
+namespace app\data\controller\api;
+
+use app\data\model\DataResCenter;
+use app\data\model\DataXw;
+use app\data\model\DataXwAd;
+use app\data\model\DataXwCategory;
+use think\admin\Controller;
+use hg\apidoc\annotation\Title;
+use hg\apidoc\annotation\Returned;
+use hg\apidoc\annotation\Param;
+use hg\apidoc\annotation\Method;
+use think\db\Query;
+
+/**
+ * @Title("资源中心")
+ */
+class ResCenter extends Auth
+{
+    /**
+     * @Title("列表")
+     * @Param ("limit",desc="每页几条",default="15")
+     * @Param ("page",desc="第几页",default="1")
+     * @Returned ("id",desc="id")
+     * @Returned ("title",desc="标题")
+     * @Returned ("c_rule",desc="规则")
+     * @Returned ("c_conv",desc="公约")
+     * @Returned ("create_time",desc="创建时间")
+     */
+    public function index(){
+        $limit=input('limit/d',1);
+        $list=DataResCenter::show()
+            ->order('id','desc')
+            ->paginate($limit);
+        $this->success('',$list);
+    }
+    /**
+     * @Title("详情")
+     * @Param ("id",desc="id")
+     * @Returned ("见列表")
+     */
+    public function show(){
+        $xw=DataResCenter::show()
+            ->where('id',input('id'))->findOrFail();
+        $this->success('',$xw);
+    }
+
+    /**
+     * @Title("获取富文本内容")
+     * @Returned ("c_rule",desc="规则")
+     * @Returned ("c_conv",desc="公约")
+     * @Returned ("c_menu",desc="清单")
+     */
+    public function config(){
+        $this->success('',array_map(function ($html){
+            return html_entity_decode($html);
+        },sysconf('config_res_center.')?:[]));
+    }
+}

+ 0 - 1
app/data/controller/api/Xw.php

@@ -30,7 +30,6 @@ class Xw extends Auth
     /**
      * @Title("列表")
      * @Param ("page",desc="第几页")
-     * @Param ("page",desc="第几页",default="1")
      * @Param ("cid",desc="分类ID")
      * @Param ("keyword",desc="搜索关键字")
      * @Param ("exad",desc="之前加载的列表中所有的广告ID,用,隔开",default="")

+ 1 - 0
config/apidoc.php

@@ -45,6 +45,7 @@ return [
                         \app\data\controller\api\business\User::class,
 
                     \app\data\controller\api\Xw::class,
+                    \app\data\controller\api\ResCenter::class,