wesmiler пре 3 месеци
родитељ
комит
84864e00ca
1 измењених фајлова са 41 додато и 7 уклоњено
  1. 41 7
      app/Http/Controllers/Api/v1/IndexController.php

+ 41 - 7
app/Http/Controllers/Api/v1/IndexController.php

@@ -29,6 +29,7 @@ class IndexController extends webApp
             $cacheKey = "caches:config:app_{$appSources}";
             $config = RedisService::get($cacheKey);
             if (empty($config)) {
+                $socialOpen = ConfigService::make()->getConfigByCode('social_open', 0);
                 $config = [
                     'app_name' => ConfigService::make()->getConfigByCode('app_name'),
                     'app_logo' => get_image_url(ConfigService::make()->getConfigByCode('app_logo')),
@@ -40,11 +41,44 @@ class IndexController extends webApp
                     'recharge_desc' => format_content(ConfigService::make()->getConfigByCode('recharge_desc', '')),
                     'wxpay_open' => ConfigService::make()->getConfigByCode('wxpay_open', 0),
                     'pay_recharge_open' => ConfigService::make()->getConfigByCode('pay_recharge_open', 0),
-                    'social_open' => ConfigService::make()->getConfigByCode('social_open', 0),
+                    'social_open' => $socialOpen,
                     'withdraw_open' => ConfigService::make()->getConfigByCode('withdraw_open', 0),
                     'withdraw_min' => ConfigService::make()->getConfigByCode('withdraw_min', 0),
                     'withdraw_fee' => ConfigService::make()->getConfigByCode('withdraw_fee', 0),
                     'notices' => NoticeService::make()->getRecommandList(),
+                    'menuList' => [
+                        [
+                            "name" => '首页',
+                            "code" => 'home',
+                            "icon" => 'home',
+                            "status"=> 1,
+                            "page" => '/pages/index/index'
+                        ], [
+                            "name" => '客服',
+                            "code" => 'custom',
+                            "icon" => 'custom',
+                            "status"=> 1,
+                        ], [
+                            "name" => '',
+                            "code" => 'social',
+                            "icon" => 'social',
+                            "status"=> $socialOpen?1:0,
+                            "page" => '/pages/social/index'
+                        ], [
+                            "name" => '购物车',
+                            "code" => 'cart',
+                            "icon" => 'cart',
+                            "badge" => 0,
+                            "status"=> 1,
+                            "page" => '/pages/cart/index'
+                        ], [
+                            "name" => '我的',
+                            "code" => 'mine',
+                            "icon" => 'mine',
+                            "status"=> 1,
+                            "page" => '/pages/mine/index'
+                        ]
+                    ]
                 ];
                 RedisService::set($cacheKey, $config, 3600);
             }
@@ -64,16 +98,16 @@ class IndexController extends webApp
     {
         try {
             $params = request()->all();
-            $type = isset($params['type']) && $params['type']?$params['type'] : 1;
-            $position = isset($params['position']) && $params['position']?$params['position'] : 1;
+            $type = isset($params['type']) && $params['type'] ? $params['type'] : 1;
+            $position = isset($params['position']) && $params['position'] ? $params['position'] : 1;
             $data = [
                 // 轮播
                 'banners' => AdService::make()->getListByPosition($position),
             ];
 
-            if($type==2){
+            if ($type == 2) {
                 $data['socials'] = SocialCircleService::make()->getIndexList();
-            }else{
+            } else {
                 $data['notices'] = NoticeService::make()->getRecommandList();
             }
 
@@ -90,12 +124,12 @@ class IndexController extends webApp
      */
     public function storeGoods()
     {
-        $params =request()->post();
+        $params = request()->post();
         try {
             $params['user_id'] = $this->userId;
             $datas = StoreService::make()->getGoodsList($params);
             return showJson(StoreService::make()->getError(), true, $datas);
-        }catch (\Exception $exception) {
+        } catch (\Exception $exception) {
             $error = ['data' => $exception->getTrace(), 'err' => $exception->getMessage()];
             return showJson(1046, false, $error);
         }