|
|
@@ -76,7 +76,9 @@ class PlayerControl extends BaseController
|
|
|
}
|
|
|
|
|
|
|
|
|
- $merchantsUserList = MerchantsUserModel::getPlayerListByIds($userInfo['merchant_id'], $unameList);
|
|
|
+ $merchantsUserList = MerchantsUserModel::getPlayerListByIds($userInfo['merchant_id'], [
|
|
|
+ ['uname', 'in', $unameList]
|
|
|
+ ]);
|
|
|
$merchantsUserList = array_column($merchantsUserList, null, 'uname');
|
|
|
|
|
|
|
|
|
@@ -89,8 +91,21 @@ class PlayerControl extends BaseController
|
|
|
if(empty($merchantsUserInfo)) {
|
|
|
continue;
|
|
|
}
|
|
|
+
|
|
|
+ $user_id = $merchantsUserInfo['user_id'];
|
|
|
+ $rtpGameLIst = CommonMerchantUserAndBalance::getMerchantUserGameRtpWinBetInfo([
|
|
|
+ ['user_id', '=' , $user_id],
|
|
|
+ ['game_id', 'in', $gameIds],
|
|
|
+ ], ['rtp','game_id']);
|
|
|
+
|
|
|
+ $gameRtp = [];
|
|
|
+ foreach ($rtpGameLIst as $item) {
|
|
|
+ $gameRtp[$item['game_id']] = $item['rtp'];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
foreach ($game_ids as $gameId) {
|
|
|
- $user_id = $merchantsUserInfo['user_id'];
|
|
|
+ $old_rtp = $gameRtp[$gameId] ?? 0;
|
|
|
$info = PlayerControlModel::getPlayerControlInfo($userInfo['merchant_id'], $user_id, $gameId);
|
|
|
$balanceInfo = $userBalanceList[$user_id] ?? [];
|
|
|
if(!empty($info)) {
|
|
|
@@ -98,14 +113,15 @@ class PlayerControl extends BaseController
|
|
|
$info->control_rpt = bcmul( $data['rtp'], 100);
|
|
|
$info->auto_cancel_rtp = bcmul($data['auto_cancel_rtp'], 100);
|
|
|
$info->max_win_multi = $data['max_win_multi'];
|
|
|
+ $info->old_rtp = $old_rtp;
|
|
|
$info->save();
|
|
|
- $message = "update";
|
|
|
}else {
|
|
|
$item = [
|
|
|
'app_id' => $userInfo['merchant_id'],
|
|
|
'user_id' => $userInfo['user_id'],
|
|
|
'player_id' => $merchantsUserInfo['user_id'],// 玩家id
|
|
|
'game_id' => $gameId,
|
|
|
+ 'old_rtp' => $old_rtp,
|
|
|
'control_rpt' => bcmul( $data['rtp'], 100),
|
|
|
'auto_cancel_rtp' => bcmul($data['auto_cancel_rtp'], 100), // 达到RTP值取消
|
|
|
'max_win_multi' => $data['max_win_multi'], // 最高倍数
|
|
|
@@ -117,4 +133,123 @@ class PlayerControl extends BaseController
|
|
|
}
|
|
|
return json_success([],'操作成功');
|
|
|
}
|
|
|
+
|
|
|
+ public function getPlayerControlList()
|
|
|
+ {
|
|
|
+ // 获取当前用户信息
|
|
|
+ $userInfo = $this->getUserInfo();
|
|
|
+
|
|
|
+ // 获取查询参数
|
|
|
+ $page = Request::get('page', 1, 'intval');
|
|
|
+ $limit = Request::get('limit', 10, 'intval');
|
|
|
+
|
|
|
+ // 过滤条件
|
|
|
+ // 筛选条件
|
|
|
+ $filters = [
|
|
|
+ // 时间筛选
|
|
|
+ 'start_time' => Request::get('start_time', '', 'trim'),
|
|
|
+ 'end_time' => Request::get('end_time', '', 'trim'),
|
|
|
+ // 游戏筛选
|
|
|
+ 'game_id' => Request::get('game_id', '', 'trim'),
|
|
|
+ // 平台ID筛选
|
|
|
+ 'uname' => Request::get('uname', '', 'trim'),
|
|
|
+ // 玩家ID筛选
|
|
|
+ 'player_id' => Request::get('user_id', '', 'trim'),
|
|
|
+ // 平台昵称
|
|
|
+ 'nickname' => Request::get('nickname', '', 'trim'),
|
|
|
+ ];
|
|
|
+
|
|
|
+
|
|
|
+ $controlWhere = [];
|
|
|
+
|
|
|
+
|
|
|
+ $where = [];
|
|
|
+ $isFindUserId = false;
|
|
|
+ // 平台ID筛选
|
|
|
+ if (!empty($filters['uname'])) {
|
|
|
+ $where[] = ['uname', '=', $filters['uname']];
|
|
|
+ $isFindUserId = true;
|
|
|
+ }
|
|
|
+ // 平台昵称筛选
|
|
|
+ if (!empty($filters['nickname'])) {
|
|
|
+ $where[] = ['nickname', 'like', '%' . $filters['nickname'] . '%'];
|
|
|
+ $isFindUserId = true;
|
|
|
+ }
|
|
|
+ // 玩家id筛选
|
|
|
+ if (!empty($filters['player_id'])) {
|
|
|
+ $where[] = ['user_id', 'like', '%' . $filters['player_id'] . '%'];
|
|
|
+ $isFindUserId = true;
|
|
|
+ }
|
|
|
+ if($isFindUserId) {
|
|
|
+ $merchantsUserIds = MerchantsUserModel::getPlayerListByIds($userInfo['merchant_id'], $where, ['user_id']);
|
|
|
+ $controlWhere[] = ['user_id', 'in', $merchantsUserIds];
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!empty($filters['game_id'])) {
|
|
|
+ $controlWhere[] = ['game_id', 'in', explode(",", $filters['game_id'])];
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!empty($filters['start_time']) && !empty($filters['end_time'])) {
|
|
|
+ $controlWhere[] = ['update_time', '>=', $filters['start_time']];
|
|
|
+ $controlWhere[] = ['update_time', '<=', $filters['end_time']];
|
|
|
+ }
|
|
|
+
|
|
|
+ $results = PlayerControlModel::getPlayerControlList($userInfo['merchant_id'], $page, $limit, $controlWhere);
|
|
|
+
|
|
|
+ $allGameList = GameModel::getGames($userInfo['merchant_id'], [], ['id', 'game_id', 'title', 'game_platform']);
|
|
|
+ $gameConfig = array_column($allGameList, null, 'game_id');
|
|
|
+
|
|
|
+ $player_id = array_column($results['list'], 'player_id');
|
|
|
+
|
|
|
+ $userListBalance = CommonMerchantUserAndBalance::getMerchantUserBalance($player_id);
|
|
|
+ $userBalanceConfig = [];
|
|
|
+ foreach ($userListBalance as $item) {
|
|
|
+ $userBalanceConfig[$item['user_id']] = $item['balance'];
|
|
|
+ }
|
|
|
+
|
|
|
+ $rtpUserList = [];
|
|
|
+ foreach ($results['list'] as $item) {
|
|
|
+ $player_id = $item['player_id'];
|
|
|
+ if(empty($rtpUserList[$player_id])) {
|
|
|
+ $rtpUserList[$player_id] = [];
|
|
|
+ }
|
|
|
+ $rtpUserList[$player_id][] = $item['game_id'];
|
|
|
+ }
|
|
|
+ $rtpConfigList = [];
|
|
|
+ foreach ($rtpUserList as $player_id => $gameIds) {
|
|
|
+ $temp = CommonMerchantUserAndBalance::getMerchantUserGameRtpWinBetInfo([
|
|
|
+ ['user_id', '=' , $player_id],
|
|
|
+ ['game_id', 'in', $gameIds],
|
|
|
+ ], ['rtp','game_id']);
|
|
|
+ foreach ($temp as $item) {
|
|
|
+ $game_id = $item['game_id'];
|
|
|
+ $rtp = $item['rtp'];
|
|
|
+ $key = "{$player_id}_{$game_id}";
|
|
|
+ $rtpConfigList[$key] = $rtp;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ foreach ($results['list'] as $key => $item) {
|
|
|
+ $game_id = $item['game_id'];
|
|
|
+ $player_id = $item['player_id'];
|
|
|
+ $one_key = "{$player_id}_{$game_id}";
|
|
|
+ $gameInfo = $gameConfig[$game_id] ?? [];
|
|
|
+ if (!empty($gameInfo))
|
|
|
+ {
|
|
|
+ $gameImages = CommonUtils::getGameDefaultImage($gameInfo);
|
|
|
+ }
|
|
|
+ $item['game_image_url'] = $gameImages['image_url'] ?? '';
|
|
|
+ $item['game_title'] = $gameInfo['title'] ?? '';
|
|
|
+ $item['game_type_text'] = CommonUtils::getGameTypeConfig($gameInfo['game_platform']);
|
|
|
+ $item['balance'] = CommonUtils::convertBalance($userBalanceConfig[$player_id] ?? 0, false);
|
|
|
+ $item['control_rpt'] = bcdiv($item['control_rpt'], 100, 2) . "%";
|
|
|
+ $item['old_rtp'] = bcdiv($item['old_rtp'], 100, 2) . "%";
|
|
|
+ $item['now_rtp'] = bcdiv($rtpConfigList[$one_key] ?? 0, 100, 2) . "%";
|
|
|
+ $results['list'][$key] = $item;
|
|
|
+ }
|
|
|
+
|
|
|
+ return json_success($results);
|
|
|
+
|
|
|
+ }
|
|
|
}
|