PPPPPPP 1 bulan lalu
induk
melakukan
8c333afaf9

+ 54 - 1
app/Game/GlobalUserInfo.php

@@ -110,8 +110,29 @@ class GlobalUserInfo extends Model
      */
      */
     public static function getGameUserInfo($key, $value)
     public static function getGameUserInfo($key, $value)
     {
     {
-        return self::query()->where($key, $value)->first();
+        $cacheKey = "GlobalUserInfo:{$key}:{$value}";
 
 
+        // 尝试从缓存获取
+        $cached = Redis::get($cacheKey);
+        if ($cached !== null && $cached !== false) {
+            $data = json_decode($cached, true);
+            if ($data) {
+                $instance = new self();
+                $instance->exists = true;
+                $instance->setRawAttributes($data, true);
+                return $instance;
+            }
+        }
+
+        // 从数据库查询
+        $user = self::query()->where($key, $value)->first();
+
+        // 缓存结果(300秒 = 5分钟)
+        if ($user) {
+            Redis::setex($cacheKey, 300, json_encode($user->getAttributes()));
+        }
+
+        return $user;
     }
     }
 
 
     /**
     /**
@@ -229,4 +250,36 @@ class GlobalUserInfo extends Model
         $this->update(['FavoriteGames'=>implode(',',$gids)]);
         $this->update(['FavoriteGames'=>implode(',',$gids)]);
 
 
     }
     }
+
+    /**
+     * 模型启动方法,注册事件监听
+     */
+    protected static function boot()
+    {
+        parent::boot();
+
+        // 监听 saved 事件(包括 created 和 updated)
+        static::saved(function ($user) {
+            $user->clearUserCache();
+        });
+
+        // 监听 deleted 事件
+        static::deleted(function ($user) {
+            $user->clearUserCache();
+        });
+    }
+
+    /**
+     * 清除用户缓存
+     */
+    private function clearUserCache()
+    {
+        $keys = ['UserID', 'GlobalUID', 'Email', 'Phone','Accounts','FPID'];
+        foreach ($keys as $key) {
+            if (isset($this->attributes[$key]) && !empty($this->attributes[$key])) {
+                $cacheKey = "GlobalUserInfo:{$key}:{$this->attributes[$key]}";
+                Redis::del($cacheKey);
+            }
+        }
+    }
 }
 }

+ 1 - 1
app/Game/PageModule.php

@@ -177,7 +177,7 @@ class PageModule extends Model
     private function handleSmallGameList()
     private function handleSmallGameList()
     {
     {
 
 
-        $pageSize = 16; // 从请求获取pageSize或使用默认值
+        $pageSize = 15; // 从请求获取pageSize或使用默认值
         // 获取与模块相关的游戏列表并应用分页
         // 获取与模块相关的游戏列表并应用分页
         $gamesQuery = $this->games();
         $gamesQuery = $this->games();
         if($gamesQuery) {
         if($gamesQuery) {

+ 3 - 3
app/Game/WebChannelConfig.php

@@ -100,15 +100,15 @@ class WebChannelConfig extends Model
         $cacheKey = self::$key . $channel;
         $cacheKey = self::$key . $channel;
 
 
 //        $cachedConfig = Redis::get($cacheKey);
 //        $cachedConfig = Redis::get($cacheKey);
-//
+
 //        if ($cachedConfig) {
 //        if ($cachedConfig) {
-//            return new WebChannelConfig(json_decode($cachedConfig,true));
+//            return new self(json_decode($cachedConfig,true));
 //        }
 //        }
 
 
         $config = self::where('Channel', $channel)->first();
         $config = self::where('Channel', $channel)->first();
 
 
         if ($config) {
         if ($config) {
-            Redis::setex($cacheKey, 60, $config->toJson());
+            Redis::setex($cacheKey, 30, $config->toJson());
         }
         }
 
 
         return $config;
         return $config;

+ 1 - 0
app/Http/Controllers/Game/ActivityController.php

@@ -204,6 +204,7 @@ class ActivityController extends Controller
     }
     }
     public function RedCheck(Request $request)
     public function RedCheck(Request $request)
     {
     {
+        return apiReturnSuc('');
         $maxRedpack=24680;
         $maxRedpack=24680;
         $currentDateTime = Carbon::now();
         $currentDateTime = Carbon::now();
         $currentTime = $currentDateTime->format('H:i:s');
         $currentTime = $currentDateTime->format('H:i:s');

+ 28 - 19
app/Http/Controllers/Game/WebPageModuleController.php

@@ -9,6 +9,7 @@ use App\Game\PageModule;
 use App\Game\Route;
 use App\Game\Route;
 use App\Http\Controllers\Controller;
 use App\Http\Controllers\Controller;
 use Illuminate\Http\Request;
 use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Redis;
 
 
 
 
 // use Yansongda\Pay\Log;
 // use Yansongda\Pay\Log;
@@ -19,32 +20,40 @@ class WebPageModuleController extends Controller
 
 
     public function PageModules(Request $request,$page_id){
     public function PageModules(Request $request,$page_id){
 
 
+        $key="pages_".$page_id;
+//        $data=Redis::get($key);
+        $data=null;
+        if(!$data){
+            $modules = PageModule::with(['subs' => function ($query) {
+                $query->with('subs'); // 递归加载子模块
+            }])->where('page_id', $page_id)->whereNull('parent_id')->orderBy('pos_index')->get();
+
+            if ($request->input('abc')) {
+
+                // 遍历打印每个模块及其子模块
+                foreach ($modules as $module) {
+                    echo "=== Module ID: {$module->id} ===\n";
+                    echo "Type: {$module->type}\n";
+                    echo "Subs Count: " . $module->subs->count() . "\n";
+                    //echo "Subs Data:\n";
+                    //print_r($module->subs->toArray());
+                    echo "\n\n";
+                    echo "\br\br";
+                }
 
 
-        $modules = PageModule::with(['subs' => function ($query) {
-            $query->with('subs'); // 递归加载子模块
-        }])->where('page_id', $page_id)->whereNull('parent_id')->orderBy('pos_index')->get();
-
-        if($request->input('abc')){
-
-            // 遍历打印每个模块及其子模块
-            foreach ($modules as $module) {
-                echo "=== Module ID: {$module->id} ===\n";
-                echo "Type: {$module->type}\n";
-                echo "Subs Count: " . $module->subs->count() . "\n";
-                //echo "Subs Data:\n";
-                //print_r($module->subs->toArray());
-                echo "\n\n";
-                echo "\br\br";
             }
             }
-
+            $data=$modules->map(function (PageModule $module) {
+                return $module->getSpecificDataAttribute();
+            });
+            Redis::setex($key,600,json_encode($data));
+        }else{
+            $data=json_decode($data,true);
         }
         }
 
 
 
 
         return response()->json([
         return response()->json([
             'code' => 0,
             'code' => 0,
-            'data' => $modules->map(function (PageModule $module) {
-                return $module->getSpecificDataAttribute();
-            }),
+            'data' => $data,
             'msg' => '',
             'msg' => '',
         ]);
         ]);
     }
     }

+ 2 - 3
app/Http/Controllers/Game/WebRouteController.php

@@ -164,9 +164,8 @@ class WebRouteController extends Controller
         if(env('CONFIG_24680_NFTD_99',0)==0)if($config->Channel==99)$firstBonus=0;
         if(env('CONFIG_24680_NFTD_99',0)==0)if($config->Channel==99)$firstBonus=0;
 
 
         $registerBonus = SystemStatusInfo::OnlyGetCacheValue('GrantScoreCountNew') ?? 1000;
         $registerBonus = SystemStatusInfo::OnlyGetCacheValue('GrantScoreCountNew') ?? 1000;
-        $chat = DB::connection('write')->table('QPAccountsDB.dbo.SystemStatusInfo')
-            ->where('StatusName', 'Telegram')
-            ->first();
+//        $chat = SystemStatusInfo::OnlyGetCacheValue('Telegram');
+        $chat_service="https://c.24680.com/c.html?pf=winus7777.com&uid="
 
 
         $recommendGame = '/game/931';
         $recommendGame = '/game/931';
 
 

+ 0 - 1
app/Notification/TelegramBot.php

@@ -57,7 +57,6 @@ class TelegramBot
             $client->post( $url , [
             $client->post( $url , [
                 'form_params' => ['str'=>$str], // 传递 POST 数据
                 'form_params' => ['str'=>$str], // 传递 POST 数据
             ]);
             ]);
-            return;
         }
         }
         $str=substr($str,0,4000);
         $str=substr($str,0,4000);
         try {
         try {

+ 1 - 0
app/Util.php

@@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Validator;
 
 
 
 
 class Util {
 class Util {
+
     /**
     /**
      * 根据南美国家(两位字母缩写)验证电话号码
      * 根据南美国家(两位字母缩写)验证电话号码
      *
      *

+ 1 - 1
routes/game.php

@@ -46,7 +46,7 @@ Route::any('/lucky/provider_games', 'Game\LuckyStreakController@providerGameList
 Route::any('/hooks/sfp', 'Game\ServiceRedirectController@sfpHook');
 Route::any('/hooks/sfp', 'Game\ServiceRedirectController@sfpHook');
 Route::any('/gotowhats', 'Game\ServiceRedirectController@whatsAppRedirect');
 Route::any('/gotowhats', 'Game\ServiceRedirectController@whatsAppRedirect');
 //Route::any('/redpack/config', 'Game\ActivityController@RedConfig');
 //Route::any('/redpack/config', 'Game\ActivityController@RedConfig');
-//Route::any('/redpack/check', 'Game\ActivityController@RedCheck');
+Route::any('/redpack/check', 'Game\ActivityController@RedCheck');
 Route::any('/click', 'Game\AgentSystemController@ClickScore');
 Route::any('/click', 'Game\AgentSystemController@ClickScore');
 
 
 Route::any('/register', 'Game\LoginController@registerUser');
 Route::any('/register', 'Game\LoginController@registerUser');