|
|
@@ -3,6 +3,7 @@
|
|
|
namespace app\controller;
|
|
|
|
|
|
use app\BaseController;
|
|
|
+use app\common\CommonUtils;
|
|
|
use app\model\GameModel;
|
|
|
use app\model\MerchantsUserModel;
|
|
|
use app\model\PlayerControlModel;
|
|
|
@@ -21,8 +22,8 @@ class PlayerControl extends BaseController
|
|
|
'account_ids' => "",
|
|
|
'game_ids' => "",
|
|
|
'rtp' => 0,
|
|
|
- 'max_win_multi' => -1,
|
|
|
- 'auto_cancel_rtp' => -1
|
|
|
+ 'max_win_multi' => 0,
|
|
|
+ 'auto_cancel_rtp' => 0
|
|
|
]);
|
|
|
|
|
|
// 判断RTP
|
|
|
@@ -77,33 +78,40 @@ class PlayerControl extends BaseController
|
|
|
$merchantsUserList = MerchantsUserModel::getPlayerListByIds($userInfo['merchant_id'], $unameList);
|
|
|
$merchantsUserList = array_column($merchantsUserList, null, 'uname');
|
|
|
|
|
|
+
|
|
|
+ $merchantsUserIds = array_column($merchantsUserList, 'user_id');
|
|
|
+ $userBalanceList = MerchantUserAndBalance::getMerchantUserBalance($merchantsUserIds);
|
|
|
+ $userBalanceList = array_column($userBalanceList, null, 'user_id');
|
|
|
+
|
|
|
foreach ($account_ids as $accountId) {
|
|
|
$merchantsUserInfo = $merchantsUserList[$accountId] ?? [];
|
|
|
if(empty($merchantsUserInfo)) {
|
|
|
continue;
|
|
|
}
|
|
|
foreach ($game_ids as $gameId) {
|
|
|
- $info = PlayerControlModel::getPlayerControlInfo($userInfo['merchant_id'], $merchantsUserInfo['user_id'], $gameId);
|
|
|
+ $user_id = $merchantsUserInfo['user_id'];
|
|
|
+ $info = PlayerControlModel::getPlayerControlInfo($userInfo['merchant_id'], $user_id, $gameId);
|
|
|
+ $balanceInfo = $userBalanceList[$user_id] ?? [];
|
|
|
if(!empty($info)) {
|
|
|
// 需要更新
|
|
|
- $item = [
|
|
|
- 'control_rpt' => $data['rtp'],
|
|
|
- 'auto_cancel_rtp' => $data['auto_cancel_rtp'], // 达到RTP值取消
|
|
|
- 'max_win_multi' => $data['max_win_multi'], // 最高倍数
|
|
|
- ];
|
|
|
+ $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->save();
|
|
|
+ $message = "update";
|
|
|
}else {
|
|
|
$item = [
|
|
|
'app_id' => $userInfo['merchant_id'],
|
|
|
'user_id' => $userInfo['user_id'],
|
|
|
'player_id' => $merchantsUserInfo['user_id'],// 玩家id
|
|
|
'game_id' => $gameId,
|
|
|
- 'control_rpt' => $data['rtp'],
|
|
|
- 'auto_cancel_rtp' => $data['auto_cancel_rtp'], // 达到RTP值取消
|
|
|
+ 'control_rpt' => bcmul( $data['rtp'], 100),
|
|
|
+ 'auto_cancel_rtp' => bcmul($data['auto_cancel_rtp'], 100), // 达到RTP值取消
|
|
|
'max_win_multi' => $data['max_win_multi'], // 最高倍数
|
|
|
- 'control_balance' => $merchantsUserInfo['balance'], // 设置时点控那刻当前余额
|
|
|
+ 'control_balance' => CommonUtils::convertBalance( $balanceInfo['balance'], false), // 设置时点控那刻当前余额
|
|
|
];
|
|
|
+ PlayerControlModel::create($item);
|
|
|
}
|
|
|
- print_r($item);
|
|
|
}
|
|
|
}
|
|
|
return json_success([],'操作成功');
|