Sfoglia il codice sorgente

有条件放开paypal

Tree 1 giorno fa
parent
commit
2deb6f295c

+ 15 - 2
app/Http/Controllers/Game/PayRechargeController.php

@@ -799,6 +799,13 @@ class PayRechargeController extends Controller
             return apiReturnFail(['web.gift.bankruptcy_gift_not_exists', __('web.gift.bankruptcy_gift_not_exists')]);
         }
 
+
+        $userData = null;
+        if ($user->UserID > 0) {
+            $userData = GlobalUserInfo::getGameUserInfo('UserID', $user->UserID);
+            if ($userData) $userData = GlobalUserInfo::toWebData($userData);
+        }
+
         $result = [];
         
         // 遍历每条礼包配置,根据 recommend 关联 recharge_gear
@@ -814,7 +821,7 @@ class PayRechargeController extends Controller
                 $gear->total_bonus = $gift->total_bonus;
                 $gear->bonus = $gift->total_bonus - 100;
                 if (!empty($gear->gear)) {
-                    $gear->gear = Util::filterGearByDevice($gear->gear);
+                    $gear->gear = Util::filterGearByDevice($gear->gear,$userData);
                 }
                 $result[] = $gear;
             }
@@ -1191,6 +1198,12 @@ class PayRechargeController extends Controller
             ]);
         }
 
+        $user = null;
+        if ($userId > 0) {
+            $user = GlobalUserInfo::getGameUserInfo('UserID', $userId);
+            if ($user) $user = GlobalUserInfo::toWebData($user);
+        }
+
         $avgRecharge = $totalRecharge / $rechargeTimes;
 
         // 4. 按规则选择礼包金额
@@ -1312,7 +1325,7 @@ class PayRechargeController extends Controller
                 $gear->total_reward_percent = $totalRewardPercent;
                 $gear->recommend = 1;
                 if (!empty($gear->gear)) {
-                    $gear->gear = Util::filterGearByDevice($gear->gear);
+                    $gear->gear = Util::filterGearByDevice($gear->gear,$user);
                 }
                 $payload['list'] = [$gear];
             } else {

+ 25 - 0
app/Http/Controllers/Game/PaymentEntryController.php

@@ -43,6 +43,31 @@ class PaymentEntryController {
 //        ];
 
 
+
+        // 退款订单限制(仅在 pay_method = 2 时生效)
+        if ((int)$pay_method === 2) {
+            $refundCacheKey = 'user_refund_paymethod2_' . $userId;
+            // 如果缓存中已经标记过有退款订单,则直接拦截
+            if (Redis::get($refundCacheKey)) {
+                return apiReturnFail(['web.payment.paytype_error','Refund Order Exists']);
+            }
+
+            // 查询是否存在退款订单(pay_status = 9 且 order_title = 2)
+            $hasRefundOrder = DB::connection('write')
+                ->table('agent.dbo.order')
+                ->where('user_id', $userId)
+//                ->where('order_title', 2)
+                ->where('pay_status', 9)
+                ->exists();
+
+            // 有退款订单则写入缓存并返回错误
+            if ($hasRefundOrder) {
+                // 缓存一段时间,避免频繁查询
+                Redis::setex($refundCacheKey, 86400, 1);
+                return apiReturnFail(['web.payment.paytype_error','Refund Order Exists']);
+            }
+        }
+
         $query = DB::table('agent.dbo.admin_configs')->where($where)->value('config_key');
 
         if ($query === null || $query === false) {

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

@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Game;
 
 use App\dao\Pay\AccountPayInfo;
 use App\Facade\TableName;
+use App\Game\GlobalUserInfo;
 use App\Http\helper\NumConfig;
 use App\Http\logic\api\CashPayLogic;
 use App\Http\logic\api\RechargeLogic;
@@ -29,6 +30,13 @@ class RechargeController
     public function gear(Request $request)
     {
 
+        $UserID = (int)$request->globalUser->UserID ?? 0;
+        $vip = 0;
+        $user = null;
+        if ($UserID > 0) {
+            $user = GlobalUserInfo::getGameUserInfo('UserID', $UserID);
+            if ($user) $user = GlobalUserInfo::toWebData($user);
+        }
 
         $list = DB::table('agent.dbo.recharge_gear')
             ->where('in_shop', 1)
@@ -37,7 +45,7 @@ class RechargeController
 
         foreach ($list as $item) {
             if (!empty($item->gear)) {
-                $item->gear = Util::filterGearByDevice($item->gear);
+                $item->gear = Util::filterGearByDevice($item->gear,$user);
             }
         }
 

+ 10 - 2
app/Util.php

@@ -429,7 +429,7 @@ class Util {
      * @param string|array $gear
      * @return string|array
      */
-    public static function filterGearByDevice($gear)
+    public static function filterGearByDevice($gear,$user=null)
     {
         $isString = false;
         if (is_string($gear)) {
@@ -451,7 +451,7 @@ class Util {
 
         $deviceType = self::getDeviceType();
 
-        $filtered = array_filter($gearArray, function ($item) use ($deviceType) {
+        $filtered = array_filter($gearArray, function ($item) use ($deviceType,$user) {
             $status = $item['status'] ?? 1;
             if ($status != 1) {
                 return true;
@@ -476,6 +476,14 @@ class Util {
                 return false;
             }
 
+            if($value === 2){
+                if(is_array($user)){
+                    if($user['vip'] < 2 || (strtotime($user['RegisterDate']) > time()-86400*2)){
+                        return false;
+                    }
+                }
+            }
+
             return true;
         });