瀏覽代碼

Merge branch 'develop'

xielin 5 年之前
父節點
當前提交
8b113793b8
共有 2 個文件被更改,包括 19 次插入0 次删除
  1. 18 0
      app/Repositories/BeanRepository.php
  2. 1 0
      config/customer.tpl

+ 18 - 0
app/Repositories/BeanRepository.php

@@ -209,9 +209,27 @@ class BeanRepository
         }
         $star_home['user']['username'] = $userInfo['username'];
         $star_home['user']['avatar'] = $userInfo['avatar'];
+        //battle信息
+        $activityInfo = $this->getActivity();
+        $star_home['battle']['start'] = $activityInfo['start'];
+        $star_home['battle']['end'] = $activityInfo['end'];
+        $star_home['battle']['news'] = Redis::get('battle_latest_info_'.$activityInfo['id'])??'战场四平八稳,劳驾老板亲自去战场督战';
         return $star_home;
 
     }
+    function getActivity(){
+        $activity = config('customer.battle_activity_info');
+        $activityInfo = ['id'=>1];
+        if($activity){
+            try{
+                $activityInfo = \GuzzleHttp\json_decode($activity,true);
+            }catch (\Exception $e){
+                Log::debug('解析活动信息配置失败:'.$e->getMessage());
+                return $activityInfo;
+            }
+        }
+        return $activityInfo;
+    }
 
     //获取某用户豆数
     function get_user_bean($uid)

+ 1 - 0
config/customer.tpl

@@ -9,4 +9,5 @@ return [
     'post_delete_image' => '{post_delete_image}',
     'category_hot_img' => '{category_hot_img}',
     'category_my_img' => '{category_my_img}',
+    'battle_activity_info' => '{battle_activity_info}',
 ];