Browse Source

2023-5-22-1 新增服务区-2

yingzi 2 years ago
parent
commit
6e98272860
2 changed files with 18 additions and 3 deletions
  1. 15 2
      app/api/controller/Pub.php
  2. 3 1
      app/api/route/pub.php

+ 15 - 2
app/api/controller/Pub.php

@@ -11,6 +11,7 @@
 declare (strict_types=1);
 declare (strict_types=1);
 
 
 namespace app\api\controller;
 namespace app\api\controller;
+use app\model\api\ArticleModel;
 use think\facade\View;
 use think\facade\View;
 use app\BaseController;
 use app\BaseController;
 use app\Request;
 use app\Request;
@@ -352,7 +353,19 @@ class Pub extends BaseController
         }));
         }));
         return app('json')->success($rankList);
         return app('json')->success($rankList);
     }
     }
-   
+
+
+
+    //获取文章详情
+    public function getArtDetail(\think\Request $request)
+    {
+        $id = $request->param('id');
+        $article = ArticleModel::where('id', $id)->find();
+        if (!$article) {
+            return app('json')->fail('文章不存在');
+        }
+        return app('json')->success(['list' => [$article], 'count' => 1]);
+    }
 
 
     
     
     /**
     /**
@@ -418,7 +431,7 @@ class Pub extends BaseController
         
         
         
         
     }
     }
-    
+
     
     
     
     
 }
 }

+ 3 - 1
app/api/route/pub.php

@@ -32,12 +32,14 @@ Route::group('pub', function () {
     Route::rule('getServiceLabelList','Pub/getServiceLabelList');
     Route::rule('getServiceLabelList','Pub/getServiceLabelList');
     //获取其他用户名片详情
     //获取其他用户名片详情
     Route::rule('getCommonUserCardInfo','Pub/getCommonUserCardInfo');
     Route::rule('getCommonUserCardInfo','Pub/getCommonUserCardInfo');
-    // 获取名片浏览量排行榜
+    //获取名片浏览量排行榜
     Route::rule('getCardLookCountRank', 'Pub/getCardLookCountRank');
     Route::rule('getCardLookCountRank', 'Pub/getCardLookCountRank');
     //获取分享信息
     //获取分享信息
     Route::rule('getShareInfo','Pub/getShareInfo');
     Route::rule('getShareInfo','Pub/getShareInfo');
     //获取精选列表
     //获取精选列表
     Route::rule('getWorkerList','Pub/getWorkerList');
     Route::rule('getWorkerList','Pub/getWorkerList');
+    //获取文章详情
+    Route::rule('getArtDetail','pub/getArtDetail');