Tree 3 viikkoa sitten
vanhempi
sitoutus
01ffb547f7

+ 2 - 2
app/Console/Commands/RecordPlatformData.php

@@ -137,7 +137,7 @@ class RecordPlatformData extends Command
 
             if ($OrderWithDraw->isNotEmpty()) {
                 foreach ($OrderWithDraw as $item) {
-                    $data = ['DateID' => $dateID, 'ApplyWithdraw' => $item->WithDraw, 'ApplyWithdrawCount' => $item->UserCount, 'ApplyWithdrawBi' => $item->CountBi];
+                    $data = ['DateID' => $dateID, 'ApplyWithdraw' => (int)$item->WithDraw, 'ApplyWithdrawCount' => $item->UserCount, 'ApplyWithdrawBi' => $item->CountBi];
                     // 申请提现渠道修改
                     $dao->Update($data, $value->Channel, $item->Channel, $dateID);
                 }
@@ -147,7 +147,7 @@ class RecordPlatformData extends Command
             if ($ServiceFee->isNotEmpty()) {
                 // 提现完成手续费渠道修改
                 foreach ($ServiceFee as $item) {
-                    $data = ['DateID' => $dateID, 'WithdrawFree' => $item->ServiceFee];
+                    $data = ['DateID' => $dateID, 'WithdrawFree' => (int)$item->ServiceFee];
 
                     $dao->Update($data, $value->Channel, $item->Channel, $dateID);
 

+ 5 - 19
app/Game/Services/OuroGameService.php

@@ -60,32 +60,14 @@ class OuroGameService
         $ingame_state=Redis::get($key)??-1;
         return intval($ingame_state);
     }
-    public static function AddScore($UserID,$GiftScore,$reason=null,$record=true)
+    public static function AddScore($UserID,$GiftScore,$reason=null,$notify=true)
     {
         // 增加用户金币
         $OrgScore = DB::table('QPTreasureDB.dbo.GameScoreInfo')->where('UserID', $UserID)->value('Score');
 
         Log::info('OuroService变化金币' . $GiftScore);
         DB::table('QPTreasureDB.dbo.GameScoreInfo')->where('UserID', $UserID)->increment('Score',$GiftScore);
-
         $NowScore=$OrgScore+$GiftScore;
-        if(!$record){
-            return [$OrgScore,$NowScore];
-        }
-        // 服务器通知
-
-//        $url = config('transfer.stock')['url'] . 'notifyPay';
-//
-//        $data = [
-//            'userid' =>  $UserID,
-//            'getScore' => $GiftScore,
-//            'score' => $NowScore,
-//        ];
-
-//        (new HttpCurl())->service($url, $data);
-        self::notifyWebHall($UserID,"",'pay_finish',["Golds"=>$NowScore,"PayNum"=>$GiftScore]);
-
-
         RecordScoreInfo::addScore($UserID, $GiftScore, $reason, $OrgScore); #赠送彩金
 
         if($reason){
@@ -94,6 +76,10 @@ class OuroGameService
             use QPRecordDB;
             exec QPRecordDB.dbo.GSP_YN_GR_RecordGameScore $UserID,$GiftScore,$reason,0,'',0,0");
         }
+        if(!$notify){
+            return [$OrgScore,$NowScore];
+        }
+        self::notifyWebHall($UserID,"",'pay_finish',["Golds"=>$NowScore,"PayNum"=>$GiftScore]);
 
         return [$OrgScore,$NowScore];
     }

+ 24 - 0
app/Http/Controllers/Admin/GameNumberMappingController.php

@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Admin;
 
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Redis;
 use Illuminate\Support\Facades\Validator;
 
 class GameNumberMappingController
@@ -103,6 +104,10 @@ class GameNumberMappingController
                         'updated_at' => now(),
                     ]);
 
+                // 清除缓存
+                $cacheKey = 'game_number_mapping:' . $request->number;
+                Redis::del($cacheKey);
+
                 return apiReturnSuc('添加成功');
             } catch (\Exception $e) {
                 return apiReturnFail('添加失败:' . $e->getMessage());
@@ -179,6 +184,9 @@ class GameNumberMappingController
             }
 
             try {
+                // 获取旧的 number,用于清除旧缓存
+                $oldNumber = $mapping->number;
+                
                 DB::connection('write')
                     ->table('agent.dbo.game_number_mapping')
                     ->where('id', $id)
@@ -188,6 +196,11 @@ class GameNumberMappingController
                         'updated_at' => now(),
                     ]);
 
+                // 清除旧的和新的缓存
+                $oldCacheKey = 'game_number_mapping:' . $oldNumber;
+                $newCacheKey = 'game_number_mapping:' . $request->number;
+                Redis::del([$oldCacheKey, $newCacheKey]);
+
                 return apiReturnSuc('修改成功');
             } catch (\Exception $e) {
                 return apiReturnFail('修改失败:' . $e->getMessage());
@@ -225,12 +238,23 @@ class GameNumberMappingController
     public function delete(Request $request, $id)
     {
         try {
+            // 先获取要删除的记录,用于清除缓存
+            $mapping = DB::connection('write')
+                ->table('agent.dbo.game_number_mapping')
+                ->where('id', $id)
+                ->first();
+
             $deleted = DB::connection('write')
                 ->table('agent.dbo.game_number_mapping')
                 ->where('id', $id)
                 ->delete();
 
             if ($deleted) {
+                // 清除缓存
+                if ($mapping) {
+                    $cacheKey = 'game_number_mapping:' . $mapping->number;
+                    Redis::del($cacheKey);
+                }
                 return apiReturnSuc('删除成功');
             } else {
                 return apiReturnFail('删除失败,记录不存在');

+ 8 - 1
app/Http/Controllers/Admin/RechargeController.php

@@ -222,7 +222,7 @@ class RechargeController extends Controller
         } else {
 
             $build_sql = $build_sql
-                ->selectRaw('o.*,og.goods_id,g.title,og.price as og_price,og.quantity as og_quantity,ai.GameID as ai_GameID,au.account,ar.RecordID,ar.remarks ar_remarks,ascore.Score as score,aphone.PhoneNum as Phone,ascore.MaxScore as MaxScore,ascore.MaxWinScore as MaxWinScore')
+                ->selectRaw('o.*,og.goods_id,og.price as og_price,og.quantity as og_quantity,ai.GameID as ai_GameID,au.account,ar.RecordID,ar.remarks ar_remarks,ascore.Score as score,aphone.PhoneNum as Phone,ascore.MaxScore as MaxScore,ascore.MaxWinScore as MaxWinScore')
                 ->lock('with(nolock)')
                 ->where($where);
             if (!empty($amountSort)) {
@@ -260,6 +260,7 @@ class RechargeController extends Controller
                 '-1' => '商城',
                 '301' => '首充',
                 '302' => '破产礼包',
+                '401' => '转盘活动充值',
             ];
             // 充值金额 10,50,100,200,300.500,800,1000,2000,5000,10000,20000,50000,80000,100000
             $chargeMoneyList = [10,20, 50, 100, 200, 500, 1000, 5000, 10000, 30000];
@@ -298,6 +299,12 @@ class RechargeController extends Controller
                 'chargeMoney' => $chargeMoney,
                 'amountSort' => $amountSort,
                 'request' => $request,
+                'payMethods' => [
+                    1 => 'cashapp',
+                    2 => 'paypal',
+                    4 => 'applepay',
+                    8 => 'googlepay'
+                ]
             ]);
         }
     }

+ 50 - 0
app/Http/Controllers/Game/LoginController.php

@@ -1310,6 +1310,56 @@ class LoginController extends Controller
 //            $guser['password'] = $password;
 //        }
 
+        $defaultGameId = 931;
+        $recommendGame = '/game/' . $defaultGameId;
+        $guser['recommendGame'] = $recommendGame;
+        // 如果用户信息存在,根据GameID的最后一位数字查询映射关系
+        if ($guser && isset($guser['GameID'])) {
+            $gameId = (string)$guser['GameID'];
+            $lastDigit = (int)substr($gameId, -1); // 获取最后一位数字
+
+            // 查询映射关系(带缓存)
+            $cacheKey = 'game_number_mapping:' . $lastDigit;
+            $mapping = null;
+            $cacheHit = false;
+            
+            // 尝试从缓存获取
+            $cached = Redis::get($cacheKey);
+            if ($cached !== null) {
+                $decoded = json_decode($cached, true);
+                // 如果解码成功且不是空数组,说明有数据
+                if (is_array($decoded) && !empty($decoded)) {
+                    $mapping = (object)$decoded; // 转换为对象以保持兼容性
+                    $cacheHit = true;
+                } elseif ($decoded === []) {
+                    // 空数组表示数据库中没有记录,已缓存,直接跳过查询
+                    $cacheHit = true;
+                    $mapping = null;
+                }
+            }
+            
+            // 缓存未命中,查询数据库
+            if (!$cacheHit) {
+                $mapping = DB::connection('write')
+                    ->table('agent.dbo.game_number_mapping')
+                    ->where('number', $lastDigit)
+                    ->first();
+                
+                // 存入缓存,24小时过期
+                if ($mapping) {
+                    Redis::setex($cacheKey, 86400, json_encode($mapping));
+                } else {
+                    // 即使不存在也缓存,避免频繁查询,缓存5分钟
+                    Redis::setex($cacheKey, 300, json_encode([]));
+                }
+            }
+
+            if ($mapping && !empty($mapping) && isset($mapping->game_id) && $mapping->game_id) {
+                $recommendGame = '/game/' . $mapping->game_id;
+            }
+            $guser['recommendGame'] = $recommendGame;
+        }
+
         Util::WriteLog('register_params',[$request,$guser]);
         return response()->json(apiReturnSuc($guser, ['reg.success', 'Registro realizado com sucesso!']));//->withCookie($this->setLoginCookie($guser['sign']));
     }

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

@@ -129,6 +129,7 @@ class PayRechargeController extends Controller
                 ->select('money', 'favorable_price', 'give', 'gear')
                 ->orderBy('money', 'asc')
                 ->where('status', 1)
+                ->where('in_shop', 1)
                 ->get();
             
             foreach ($list as &$val) {

+ 0 - 17
app/Http/Controllers/Game/WebRouteController.php

@@ -175,23 +175,6 @@ class WebRouteController extends Controller
         // 默认推荐游戏
         $defaultGameId = 931;
         $recommendGame = '/game/' . $defaultGameId;
-        
-        // 如果用户信息存在,根据GameID的最后一位数字查询映射关系
-        if ($user && isset($user['GameID'])) {
-            $gameId = (string)$user['GameID'];
-            $lastDigit = (int)substr($gameId, -1); // 获取最后一位数字
-            
-            // 查询映射关系
-            $mapping = DB::connection('write')
-                ->table('agent.dbo.game_number_mapping')
-                ->where('number', $lastDigit)
-                ->first();
-            
-            if ($mapping && $mapping->game_id) {
-                $recommendGame = '/game/' . $mapping->game_id;
-            }
-        }
-
         $data['conf']=[
             'bb'=>$bb,
             'hall'=>env("CONFIG_24680_HALL")??GameBasicConfig::$HallServer,

+ 8 - 3
app/Services/HolidayWheelService.php

@@ -2,6 +2,8 @@
 
 namespace App\Services;
 
+use App\Game\Services\OuroGameService;
+use App\Http\helper\NumConfig;
 use App\Utility\SetNXLock;
 use App\Util;
 use Illuminate\Support\Facades\DB;
@@ -79,11 +81,11 @@ class HolidayWheelService
 
     /**
      * 充值赠送转盘次数(在充值成功后调用)
-     * 有 gift_id(首充礼包301,破产礼包302)的充值不添加次数
+     * 有 gift_id=401 的充值添加次数
      */
     public function grantTimesOnRecharge(int $userId, float $payAmt, int $giftId = 0): void
     {
-        if (in_array($giftId, [301, 302], true)) {
+        if ($giftId != 401) {
             return;
         }
 
@@ -200,7 +202,7 @@ class HolidayWheelService
 
             if (!$userRow || (int)$userRow->left_times <= 0) {
                 DB::connection('write')->rollBack();
-                throw new \RuntimeException('没有可用的转盘次数');
+                throw new \RuntimeException($userId.'没有可用的转盘次数');
             }
 
             $totalWeight = 0;
@@ -253,6 +255,8 @@ class HolidayWheelService
 
             DB::connection('write')->commit();
 
+            OuroGameService::AddScore($userId,$reward*NumConfig::NUM_VALUE,110,false);
+
             return [
                 'slot_index' => $slotIndex,
                 'reward' => $reward,
@@ -325,6 +329,7 @@ class HolidayWheelService
                     'give' => (float)$item->give,
                     'recommend' => (int)($item->recommend ?? 0),
                     'gear' => $item->gear,
+                    'gift_id' => 401,
                 ];
             } else {
                 $rule['gear'] = null;

+ 4 - 0
resources/views/admin/recharge/list.blade.php

@@ -182,6 +182,7 @@
                                     <th width="8%">{{ __('auto.最多赢分') }}</th>
 
                                     <th width="8%">{{ __('auto.咖啡来源') }}</th>
+                                    <th width="8%">支付渠道</th>
                                     <th width="7%">{{ __('auto.咖啡玩家') }}ID</th>
                                     <th width="8%">{{ __('auto.状态') }}</th>
                                     <th width="8%">{{ __('auto.来源') }}</th>
@@ -219,6 +220,9 @@
                                         <td>{{ $v->MaxWinScore }}</td>
 
                                         <td>{{$v->payment_code}}</td>
+
+                                        <td>{{@$payMethods[$v->order_title]??''}}</td>
+
                                         <td>
                                             <a href="/admin/global/id_find?UserID={{$v->UserID}}">
                                                 {{$v->ai_GameID}}