ssvfdn há 3 meses atrás
pai
commit
d59a58bdd0
1 ficheiros alterados com 17 adições e 4 exclusões
  1. 17 4
      app/controller/PlayerControl.php

+ 17 - 4
app/controller/PlayerControl.php

@@ -8,6 +8,7 @@ use app\common\CommonMerchantUserAndBalance;
 use app\model\GameModel;
 use app\model\MerchantsUserModel;
 use app\model\PlayerControlModel;
+use app\model\UserModel;
 use think\facade\Request;
 
 class PlayerControl extends BaseController
@@ -114,6 +115,11 @@ class PlayerControl extends BaseController
             foreach ($game_ids as $gameId) {
                 $old_rtp = $gameRtp[$gameId] ?? 0;
                 $info = PlayerControlModel::getPlayerControlInfo($userInfo['merchant_id'], $user_id, $gameId);
+
+                if(!empty($info) && $info->status == 0) {
+                    $info = null;
+                }
+
                 $balanceInfo = $userBalanceList[$user_id] ?? [];
                 if(!empty($info)) {
                     // 需要更新
@@ -173,6 +179,8 @@ class PlayerControl extends BaseController
             'nickname' => Request::get('nickname', '', 'trim'),
         ];
 
+        $is_end = Request::get('is_end_time', 0);
+
 
         $controlWhere = [];
         $controlWhere[] = ['user_id', '=', $userInfo['user_id']];
@@ -205,11 +213,12 @@ class PlayerControl extends BaseController
         }
 
         if(!empty($filters['start_time']) && !empty($filters['end_time'])) {
-            $controlWhere[] = ['update_time', '>=', strtotime($filters['start_time'] . " 00:00:00")];
-            $controlWhere[] = ['update_time', '<=', strtotime($filters['end_time'] . " 23:59:59")];
+
+            $controlWhere[] = [$is_end ? 'end_time' : 'update_time', '>=', strtotime($filters['start_time'] . " 00:00:00")];
+            $controlWhere[] = [$is_end ? 'end_time' :'update_time', '<=', strtotime($filters['end_time'] . " 23:59:59")];
         }
 
-        $controlWhere[] = ['status', '=', 1];
+        $controlWhere[] = ['status', '=',  $is_end ? 0 : 1];
 
         $results = PlayerControlModel::getPlayerControlList($userInfo['merchant_id'], $page, $limit, $controlWhere);
 
@@ -275,7 +284,11 @@ class PlayerControl extends BaseController
             $playerInfo = $playerConfig[$player_id] ?? [];
             $item['uname'] = $playerInfo['uname'] ?? '';
             $item['nickname'] = $playerInfo['nickname'] ?? '';
-
+            $adminInfo = UserModel::find($item['user_id']);
+            $item['admin_name'] = "";
+            if(!empty($adminInfo)) {
+                $item['admin_name'] = $adminInfo['nick_name'] ?? '';
+            }
             $results['list'][$key] = $item;
         }