1.优化websocket连接
2.修复游戏实施对局显示错误
This commit is contained in:
@@ -76,7 +76,7 @@ class Account extends Frontend
|
||||
'last_bet_period_no' => $user->last_bet_period_no ?? '',
|
||||
'create_time' => $user->create_time ?? 0,
|
||||
|
||||
// 资金字段(4 位小数字符串,与 /api/wallet/balanceSummary 对齐)
|
||||
// 资金字段(4 位小数字符串,与钱包展示口径一致)
|
||||
'coin' => floatval($coinBalance),
|
||||
'coin_balance' => floatval($coinBalance),
|
||||
'frozen_balance' => 0.00,
|
||||
|
||||
@@ -18,7 +18,7 @@ use support\Response;
|
||||
|
||||
class Game extends MobileBase
|
||||
{
|
||||
protected array $noNeedLogin = ['dictionaryList', 'periodHistory'];
|
||||
protected array $noNeedLogin = ['dictionaryList'];
|
||||
|
||||
public function lobbyInit(Request $request): Response
|
||||
{
|
||||
@@ -93,28 +93,6 @@ class Game extends MobileBase
|
||||
]);
|
||||
}
|
||||
|
||||
public function periodHistory(Request $request): Response
|
||||
{
|
||||
$response = $this->initializeMobile($request);
|
||||
if ($response !== null) {
|
||||
return $response;
|
||||
}
|
||||
$limit = $this->intValue($request->input('limit', 30));
|
||||
if ($limit < 1) {
|
||||
$limit = 30;
|
||||
}
|
||||
$list = GameRecord::whereNotNull('result_number')->order('id', 'desc')->limit($limit)->select();
|
||||
$rows = [];
|
||||
foreach ($list as $item) {
|
||||
$rows[] = [
|
||||
'period_no' => $item->period_no,
|
||||
'result_number' => $item->result_number,
|
||||
'open_time' => $item->update_time,
|
||||
];
|
||||
}
|
||||
return $this->mobileSuccess(['list' => $rows]);
|
||||
}
|
||||
|
||||
public function periodCurrent(Request $request): Response
|
||||
{
|
||||
$response = $this->initializeMobile($request);
|
||||
@@ -138,14 +116,6 @@ class Game extends MobileBase
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 与前端文档对齐:/api/game/current_status
|
||||
*/
|
||||
public function currentStatus(Request $request): Response
|
||||
{
|
||||
return $this->periodCurrent($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 兼容旧路由:/api/game/betPlace
|
||||
* 新语义与 place_bet 一致:bet_amount 作为“单注金额”。
|
||||
|
||||
@@ -4,47 +4,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\library\finance\WithdrawFlow;
|
||||
use app\common\model\UserWalletRecord;
|
||||
use Webman\Http\Request;
|
||||
use support\Response;
|
||||
|
||||
class Wallet extends MobileBase
|
||||
{
|
||||
public function balanceSummary(Request $request): Response
|
||||
{
|
||||
$response = $this->initializeMobile($request);
|
||||
if ($response !== null) {
|
||||
return $response;
|
||||
}
|
||||
$user = $this->auth->getUser();
|
||||
$coinBalance = WithdrawFlow::amountString($user->coin ?? '0');
|
||||
$flow = WithdrawFlow::status(intval($user->id), [
|
||||
'total_deposit_coin' => $user->total_deposit_coin ?? '0',
|
||||
'total_withdraw_coin' => $user->total_withdraw_coin ?? '0',
|
||||
'bet_flow_coin' => $user->bet_flow_coin ?? '0',
|
||||
]);
|
||||
$maxWithdrawable = WithdrawFlow::maxWithdrawable($coinBalance, $flow);
|
||||
return $this->mobileSuccess([
|
||||
'coin_balance' => floatval($coinBalance),
|
||||
'frozen_balance' => 0.00,
|
||||
'withdrawable_balance' => floatval($coinBalance),
|
||||
'max_withdrawable' => floatval($maxWithdrawable),
|
||||
'total_deposit_coin' => floatval(WithdrawFlow::amountString($user->total_deposit_coin ?? '0')),
|
||||
'total_withdraw_coin' => floatval(WithdrawFlow::amountString($user->total_withdraw_coin ?? '0')),
|
||||
'bet_flow_coin' => floatval($flow['bet_flow_coin']),
|
||||
'withdraw_flow' => [
|
||||
'ratio' => floatval($flow['ratio']),
|
||||
'net_deposit' => floatval($flow['net_deposit']),
|
||||
'required_bet_flow' => floatval($flow['required_bet_flow']),
|
||||
'remaining_bet_flow' => floatval($flow['remaining_bet_flow']),
|
||||
'eligible' => $flow['eligible'],
|
||||
'max_withdraw_by_flow' => $flow['flow_unlimited'] ? null : floatval($flow['max_withdraw_by_flow']),
|
||||
'flow_unlimited' => $flow['flow_unlimited'],
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public function recordList(Request $request): Response
|
||||
{
|
||||
$response = $this->initializeMobile($request);
|
||||
|
||||
Reference in New Issue
Block a user