Przeglądaj źródła

Merge branch 'master' of ssh://git.usgamewin.com:22022/laoma/admin_api

PPPPPPP 1 miesiąc temu
rodzic
commit
f2824b2853

+ 3 - 2
app/Game/Services/AgentService.php

@@ -183,10 +183,11 @@ class AgentService
                 $GlobalUID='';
             }
         }
+        $h5link = env('H5_LINK', 'https://h5t.usgamewin.com/');
         if($ActName=='WheelFree100') {
-            $link = 'https://240.lol/cw/' . self::encodeAct($GlobalUID, $ActName);
+            $link = $h5link . self::encodeAct($GlobalUID, $ActName);
         }else{
-            $link = 'https://240.lol/' . self::encodeAct($GlobalUID, $ActName);
+            $link = $h5link . self::encodeAct($GlobalUID, $ActName);
         }
         return $link;
     }

+ 3 - 12
app/Http/Controllers/Admin/RechargeController.php

@@ -258,17 +258,8 @@ class RechargeController extends Controller
 
             $sourceList = [
                 '-1' => '商城',
-                '104' => '周卡VIP1',
-                '105' => '周卡VIP2',
-                '106' => '周卡VIP3',
-                '107' => '周卡VIP4',
-                '108' => '周卡VIP5',
-                '200' => '10卢比破冰首充礼包',
-                '201' => '首充',
-                '211' => '首充2',
-                '301' => '激励1',
-                '302' => '激励2',
-                '303' => '激励3',
+                '301' => '首充',
+                '302' => '破产礼包',
             ];
             // 充值金额 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];
@@ -861,7 +852,7 @@ class RechargeController extends Controller
             $pay_methods = (int)$request->pay_methods ?: 0;  // 支付方式位掩码
             
             $logic = new RechargeLogic();
-            $res = $logic->add($money, $status, $config_ids, $favorable_price, $give, $pay_methods);
+            $res = $logic->add($money, $status, '', $favorable_price, $give, $pay_methods);
             return apiReturnSuc();
         }
         return view('admin.recharge.add', ['list' => $list]);

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

@@ -265,6 +265,7 @@ class LoginController extends Controller
     }
     public static function CheckTimeBonus(&$user)
     {
+        return;
         if(!$user)return;
         $outdatas=null;
         if($user['Channel']==99)return ;

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

@@ -643,6 +643,7 @@ class PayRechargeController extends Controller
             ->select('money', 'favorable_price', 'give','gear')
             ->orderBy('money', 'asc')
             ->where('status', 1)
+            ->where('in_shop', 1)
             ->get();
 
 //        $gear = \GuzzleHttp\json_encode($names);
@@ -699,6 +700,55 @@ class PayRechargeController extends Controller
 
         return apiReturnSuc(compact('items','default'));
     }
+    // 破产礼包
+    public function bankruptcyGift(Request $request)
+    {
+        $user = $request->user();
+        
+        // 判断用户是否充值
+        $user_recharge = DB::table(TableName::QPAccountsDB() . 'YN_VIPAccount')
+            ->where('UserID', $user->UserID)
+            ->value('Recharge') ?: 0;
+        
+        if ($user_recharge <= 0) {
+            return apiReturnFail('用户未充值');
+        }
+        
+        // 获取所有破产礼包配置 (gift_id=302)
+        $bankruptcyGifts = DB::table('agent.dbo.recharge_gift')
+            ->where('gift_id', 302)
+            ->get();
+        
+        if ($bankruptcyGifts->isEmpty()) {
+            return apiReturnFail('破产礼包配置不存在');
+        }
+
+        $result = [];
+        
+        // 遍历每条礼包配置,根据 recommend 关联 recharge_gear
+        foreach ($bankruptcyGifts as $gift) {
+            $gear = DB::table('agent.dbo.recharge_gear')
+                ->select('money', 'favorable_price', 'gear')
+                ->where('money', $gift->recommend)
+                ->where('status', 1)
+                ->first();
+            
+            if ($gear) {
+                $gear->gift_id = $gift->gift_id;
+                $gear->total_bonus = $gift->total_bonus;
+                $gear->bonus = $gift->total_bonus - 100;
+                $result[] = $gear;
+            }
+        }
+
+        // 按 money 排序
+        usort($result, function($a, $b) {
+            return $a->money <=> $b->money;
+        });
+
+        return apiReturnSuc($result);
+    }
+
     public function getSecondGive(Request $request)
     {
         $user = $request->user();
@@ -732,4 +782,7 @@ class PayRechargeController extends Controller
     }
 
 
+
+
+
 }

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

@@ -31,6 +31,7 @@ class RechargeController
 
 
         $list = DB::table('agent.dbo.recharge_gear')
+            ->where('in_shop', 1)
             ->select('id','money','favorable_price','give','recommend','gear')
             ->orderBy('money', 'asc')->where('status', 1)->get();
 

+ 44 - 69
app/Services/OrderServices.php

@@ -82,6 +82,24 @@ class  OrderServices
                         ]);
                     }
                 }
+            }if ($GiftsID == 302) { // 破产礼包
+                // 首次购买首充礼包,走赠送逻辑(立即获得bonus_instantly%)
+                $Gifts = DB::connection('write')->table('agent.dbo.recharge_gift')->where('gift_id', $GiftsID)->where('recommend', $payAmt)->first();
+                if($Gifts){
+                    $favorable_price = round($Gifts->bonus_instantly*$payAmt/100,2);
+                    $give = $favorable_price-$payAmt;
+                    $Recharge = $payAmt;
+                    $czReason = 50;
+                    $cjReason = 51;
+                }else{
+                    $Recharge = $payAmt;
+                    $give = 0;
+                    $favorable_price = $Recharge + $give;
+                    $czReason = 1;
+                    $cjReason = 45;
+                }
+
+
             }else if ($GiftsID > 400) {
                 $Status = 1;
                 $recharge_gear = DB::connection('write')->table('agent.dbo.recharge_gear')->where('status', $Status)->where('money', $payAmt)->select('favorable_price', 'give')->first();
@@ -198,50 +216,7 @@ class  OrderServices
 
 
         if ($payAmt > 0) {
-            try {
-                $userInfo = DB::table(TableName::QPAccountsDB() . 'AccountsInfo')
-                    ->where('UserID', $user_id)
-                    ->first();
-                $channelConfig = DB::table('QPPlatformDB.dbo.ChannelPackageName')->where('Channel', $userInfo->Channel)->first();
-
-
-//                Util::WriteLog('xxxxx', [$userInfo->Channel, $channelConfig, $query, $firstScore, $channelConfig->Rate > 0 && $channelConfig->ContrlScore > 0, $channelConfig->MinScore * NumConfig::NUM_VALUE > $firstScore]);
-
-                if ($channelConfig && !$query && false) {
-                    if ($channelConfig->Rate > 0 && $channelConfig->ContrlScore > 0) {
-                        if ($channelConfig->MinScore * NumConfig::NUM_VALUE >= $firstScore) {
-                            $openGames = config('games.openKGame');
-                            $query = DB::table('QPTreasureDB.dbo.UserScoreControl')->where('UserID', $user_id)->first();
-                            if (!$query) {
-                                $build_sql = DB::connection('write')->table('QPTreasureDB.dbo.UserScoreControl');
-                                //Util::WriteLog('control_old_user',$list);
-                                $data = [
-                                    'ControlScore'   => (int)($channelConfig->ContrlScore * NumConfig::NUM_VALUE),
-                                    'EffectiveScore' => 0,
-                                    'ControlKindID'  => -1,
-                                    'Remarks'        => '',
-                                    'InsertDate'     => date('Y-m-d H:i:s'),
-                                    'ControlRadian'  => 0
-                                ];
-                                $build_sql->updateOrInsert(['UserID' => $user_id], $data);
-
-                                foreach ($openGames as $GameID) {
-                                    $KindData = [
-                                        'UserID'        => $user_id,
-                                        'KindID'        => $GameID,
-                                        'ControlRadian' => $channelConfig->Rate,
-                                        'ControlDate'   => date('Y-m-d H:i:s')
-                                    ];
-                                    DB::connection('write')->table('QPTreasureDB.dbo.UserControlKind')->updateOrInsert(['UserID' => $user_id, 'KindID' => $GameID], $KindData);
-                                }
-                            }
-
-                        }
-                    }
-                }
-            } catch (\Exception $exception) {
 
-            }
             // 记录订单变化后金币
             DB::connection('write')->table('agent.dbo.order')
                 ->where('order_sn', $order_sn)
@@ -264,37 +239,37 @@ class  OrderServices
 
 
         // 周卡 -- 执行存储过程
-        if (isset($GiftsID) && $GiftsID > 100 && $GiftsID < 200) {
-            $CardID = (int)$GiftsID - 100;
-            StoredProcedure::BuyMonthCard($user_id, $CardID, $order_sn);
-            // 开始执行时间
-            $startTime = Helper::millisecond();
-            Log::info('GSP_GP_BuyMonthCard 执行时间:' . ((Helper::millisecond() - $startTime) / 1000));
-        }
+//        if (isset($GiftsID) && $GiftsID > 100 && $GiftsID < 200) {
+//            $CardID = (int)$GiftsID - 100;
+//            StoredProcedure::BuyMonthCard($user_id, $CardID, $order_sn);
+//            // 开始执行时间
+//            $startTime = Helper::millisecond();
+//            Log::info('GSP_GP_BuyMonthCard 执行时间:' . ((Helper::millisecond() - $startTime) / 1000));
+//        }
 
 
         //设置第二天要领取
-        if (isset($GiftsID) && $GiftsID >= 200 && $GiftsID < 300 ) {
-            $first = DB::table('agent.dbo.recharge_gear')->where('gift_id', $GiftsID)->select('gift_id', 'money', 'give', 'favorable_price', 'second_give')->first();
-            if ($first && $first->second_give > 0) {
-                $fpkey = 'Firstpay_' . $user_id;
-                $data = (array)$first;
-                $data['buytime'] = time();
-                $data['czReason'] = $czReason;
-                $data['cjReason'] = $cjReason;
-                Redis::set($fpkey, json_encode($data));
-                DB::table(TableName::agent() . 'guide_payment')->updateOrInsert([
-                    'UserID'     => $user_id,
-                    'GiftID'     => $GiftsID,
-                    'CreateTime' => now()
-                ], ['UserID' => $user_id]);
-            }
-        }
+//        if (isset($GiftsID) && $GiftsID >= 200 && $GiftsID < 300 ) {
+//            $first = DB::table('agent.dbo.recharge_gear')->where('gift_id', $GiftsID)->select('gift_id', 'money', 'give', 'favorable_price', 'second_give')->first();
+//            if ($first && $first->second_give > 0) {
+//                $fpkey = 'Firstpay_' . $user_id;
+//                $data = (array)$first;
+//                $data['buytime'] = time();
+//                $data['czReason'] = $czReason;
+//                $data['cjReason'] = $cjReason;
+//                Redis::set($fpkey, json_encode($data));
+//                DB::table(TableName::agent() . 'guide_payment')->updateOrInsert([
+//                    'UserID'     => $user_id,
+//                    'GiftID'     => $GiftsID,
+//                    'CreateTime' => now()
+//                ], ['UserID' => $user_id]);
+//            }
+//        }
 
         //设置第二天要领取
-        if (!empty($GiftsID) && $GiftsID >= 300 && $GiftsID < 400 ) {
-            Redis::del('repay_temp_'.$user_id);
-        }
+//        if (!empty($GiftsID) && $GiftsID >= 300 && $GiftsID < 400 ) {
+//            Redis::del('repay_temp_'.$user_id);
+//        }
 
         // 数据统计后台 -- 充值记录添加
         (new RechargeWithDraw())->recharge($user_id, $payAmt);

+ 1 - 0
routes/game.php

@@ -238,6 +238,7 @@ Route::group([
 
     $route->any('/pay/first_pay_gift', 'Game\PayRechargeController@firstPayGift'); // 首充礼包(带倒计时)
     $route->any('/pay/claim_first_pay_gift', 'Game\PayRechargeController@claimFirstPayGiftReward'); // 领取首充礼包奖励
+    $route->any('/pay/bankruptcy_gift', 'Game\PayRechargeController@bankruptcyGift'); // 破产礼包
 
     //正式
     $route->any('/pgpro/lunch', 'Game\PgSoftController@gameLunch');