wzq 5 years ago
parent
commit
883873c8a1
3 changed files with 25 additions and 1 deletions
  1. 8 1
      app/Http/Controllers/ConfigController.php
  2. 14 0
      app/Traits/CommunityTrait.php
  3. 3 0
      config/customer.tpl

+ 8 - 1
app/Http/Controllers/ConfigController.php

@@ -7,8 +7,11 @@
  */
 namespace App\Http\Controllers;
 
+use App\Traits\CommunityTrait;
+
 class ConfigController extends Controller
 {
+    use CommunityTrait;
     /**
      * Create a new controller instance.
      *
@@ -22,7 +25,11 @@ class ConfigController extends Controller
     {
         $data = [
             //商品类型
-            'order_expired_time' => config('customer.order_expired_time')
+            'order_expired_time' => config('customer.order_expired_time'),
+            'virus_url' => config('customer.VIRUS_URL'),
+            'virus_app_id' => config('customer.VIRUS_APP_ID'),
+            'virus_app_secret' => config('customer.VIRUS_APP_SECRET'),
+            'virus' => $this->getAllBehavior(),
         ];
         return $this->jsonSuccess($data, '成功');
     }

+ 14 - 0
app/Traits/CommunityTrait.php

@@ -24,4 +24,18 @@ trait CommunityTrait
         }
 
     }
+
+    public function getAllBehavior() {
+        try {
+            $sign = generateSign([], config('customer.app_secret'));
+            $url = config("customer.app_service_url").'/community/getAllBehavior';
+            $array = [
+                'json' => ['sign' => $sign], 'query' => [], 'http_errors' => false,'headers'=>['Authorization'=>"Bearer ".JWTAuth::getToken()]
+            ];
+            return http($url,$array, 'get');
+        } catch (\Exception $e) {
+            return [];
+        }
+
+    }
 }

+ 3 - 0
config/customer.tpl

@@ -6,4 +6,7 @@ return [
     'app_service_url' => '{app_service_url}',
     'chxq_oss_url' => '{chxq_oss_url}',
     'order_expired_time' => '{order_expired_time}',
+    'VIRUS_URL' => '{VIRUS_URL}',
+    'VIRUS_APP_ID' => '{VIRUS_APP_ID}',
+    'VIRUS_APP_SECRET' => '{VIRUS_APP_SECRET}',
 ];