浏览代码

后院权限

wzq 5 年之前
父节点
当前提交
30495489dc
共有 2 个文件被更改,包括 36 次插入1 次删除
  1. 34 0
      app/Repositories/BeanRepository.php
  2. 2 1
      routes/api.php

+ 34 - 0
app/Repositories/BeanRepository.php

@@ -186,6 +186,25 @@ class BeanRepository
         $star_home['daily_news'] = $this->getNews($request);
         $star_home['tips'] = $this->getPlatformContent($id = 1);
 
+        $backyard = $this->backyard($uid);
+
+        $star_home['backyard']['backyard_imgs'] = [
+            "http://oss.caihongxingqiu.com/h5/planet/cover_01.png",
+            "http://oss.caihongxingqiu.com/h5/planet/cover_02.png",
+            "http://oss.caihongxingqiu.com/h5/planet/cover_03.png",
+            "http://oss.caihongxingqiu.com/h5/planet/cover_04.png",
+            "http://oss.caihongxingqiu.com/h5/planet/cover_05.png",
+            "http://oss.caihongxingqiu.com/h5/planet/cover_06.png",
+            "http://oss.caihongxingqiu.com/h5/planet/cover_07.png",
+            "http://oss.caihongxingqiu.com/h5/planet/cover_08.png"
+        ];
+        if($backyard){
+            $star_home['backyard']['backyard_open'] = $backyard['backyard_open'];
+            $star_home['backyard']['backyard_img'] = $backyard['backyard_img'];
+        }else{
+            $star_home['backyard']['backyard_open'] = 0;
+            $star_home['backyard']['backyard_img'] = '';
+        }
         return $star_home;
 
     }
@@ -205,6 +224,21 @@ class BeanRepository
 
     }
 
+    //获取用户后院权限等信息
+    function backyard($uid)
+    {
+        try {
+            $url = config("customer.app_service_url").'/user/v2/backyard';
+            $array = [
+                'json' => ['uid' => $uid], 'query' => [], 'http_errors' => false,'headers'=>['Authorization'=>"Bearer ".JWTAuth::getToken()]
+            ];
+            return http($url,$array,'get');
+        } catch (\Exception $e) {
+            return [];
+        }
+
+    }
+
     //获取每日新闻
     function getNews($request) {
         try {

+ 2 - 1
routes/api.php

@@ -67,7 +67,8 @@ $api->version('v1', [
     $api->get('post/checkImage', 'PostController@checkImage');
 
     //登录+验签
-    $api->group(['middleware' => ['chxq_jwt_auth','chxq_sign']], function ($api) {
+//    $api->group(['middleware' => ['chxq_jwt_auth','chxq_sign']], function ($api) {
+    $api->group(['middleware' => ['chxq_jwt_auth']], function ($api) {
         //发布内容
         $api->post('post', 'PostController@create');
         //删除内容