完善接口和后台页面
This commit is contained in:
@@ -5,12 +5,14 @@ namespace app\api\controller;
|
||||
use ba\Date;
|
||||
use ba\Captcha;
|
||||
use ba\Random;
|
||||
use app\common\library\finance\WithdrawFlow;
|
||||
use app\common\model\User;
|
||||
use app\common\facade\Token;
|
||||
use app\common\model\UserScoreLog;
|
||||
use app\common\model\UserMoneyLog;
|
||||
use app\common\controller\Frontend;
|
||||
use app\common\facade\Token as TokenFacade;
|
||||
use support\think\Db;
|
||||
use support\validation\Validator;
|
||||
use support\validation\ValidationException;
|
||||
use Webman\Http\Request;
|
||||
@@ -41,17 +43,60 @@ class Account extends Frontend
|
||||
}
|
||||
|
||||
$user = $this->auth->getUser();
|
||||
$userId = intval(strval($user->id));
|
||||
$coinBalance = WithdrawFlow::amountString($user->coin ?? '0');
|
||||
|
||||
// 打码量 / 提现配额快照
|
||||
$flow = WithdrawFlow::status($userId, [
|
||||
'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);
|
||||
|
||||
// 待审核提现订单数(配合 /api/finance/withdrawCreate 的 3 笔上限)
|
||||
$pendingWithdrawCount = Db::name('withdraw_order')
|
||||
->where('user_id', $userId)
|
||||
->where('status', 0)
|
||||
->count();
|
||||
|
||||
$payload = [
|
||||
'code' => 1,
|
||||
'message' => __('ok'),
|
||||
'data' => [
|
||||
'uuid' => $user->uuid ?? '',
|
||||
'username' => $user->username,
|
||||
'head_image' => $user->avatar ?? '',
|
||||
'coin' => $user->coin,
|
||||
'current_streak' => $user->current_streak ?? 0,
|
||||
'channel_id' => $user->channel_id,
|
||||
'risk_flags' => $user->risk_flags ?? 0,
|
||||
'uuid' => $user->uuid ?? '',
|
||||
'username' => $user->username,
|
||||
'head_image' => $user->avatar ?? '',
|
||||
'phone' => $user->phone ?? '',
|
||||
'email' => $user->email ?? '',
|
||||
'register_invite_code' => $user->register_invite_code ?? '',
|
||||
'channel_id' => $user->channel_id,
|
||||
'risk_flags' => $user->risk_flags ?? 0,
|
||||
'current_streak' => $user->current_streak ?? 0,
|
||||
'last_bet_period_no' => $user->last_bet_period_no ?? '',
|
||||
'create_time' => $user->create_time ?? 0,
|
||||
|
||||
// 资金字段(4 位小数字符串,与 /api/wallet/balanceSummary 对齐)
|
||||
'coin' => $coinBalance,
|
||||
'coin_balance' => $coinBalance,
|
||||
'frozen_balance' => '0.0000',
|
||||
'total_deposit_coin' => WithdrawFlow::amountString($user->total_deposit_coin ?? '0'),
|
||||
'total_withdraw_coin' => WithdrawFlow::amountString($user->total_withdraw_coin ?? '0'),
|
||||
'bet_flow_coin' => $flow['bet_flow_coin'],
|
||||
'max_withdrawable' => $maxWithdrawable,
|
||||
'withdraw_flow' => [
|
||||
'ratio' => $flow['ratio'],
|
||||
'net_deposit' => $flow['net_deposit'],
|
||||
'required_bet_flow' => $flow['required_bet_flow'],
|
||||
'remaining_bet_flow' => $flow['remaining_bet_flow'],
|
||||
'eligible' => $flow['eligible'],
|
||||
'max_withdraw_by_flow' => $flow['flow_unlimited'] ? null : $flow['max_withdraw_by_flow'],
|
||||
'flow_unlimited' => $flow['flow_unlimited'],
|
||||
'pending_withdraw' => [
|
||||
'count' => $pendingWithdrawCount,
|
||||
'max' => WithdrawFlow::MAX_PENDING_WITHDRAW,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
return \response(json_encode($payload, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), 200, ['Content-Type' => 'application/json']);
|
||||
|
||||
Reference in New Issue
Block a user