|
|
@@ -19,6 +19,7 @@ use Illuminate\Http\Request;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
use Illuminate\Support\Facades\Hash;
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
+use Illuminate\Support\Facades\Redis;
|
|
|
use Illuminate\Support\Facades\Validator;
|
|
|
|
|
|
class WithDrawInfoController
|
|
|
@@ -122,6 +123,16 @@ class WithDrawInfoController
|
|
|
$retval = $stmt->fetch(\PDO::FETCH_ASSOC);
|
|
|
|
|
|
$retval['srate']=env('CONFIG_24680_RATE',1);
|
|
|
+ // 获取绑定手机号
|
|
|
+ $phone = DB::table(TableName::QPAccountsDB() . 'AccountPhone')->where('UserID', $UserID)->value('PhoneNum');
|
|
|
+ $phone = trim($phone);
|
|
|
+ $retval['bind_phone'] = $phone;
|
|
|
+ $hasSuccessWithdraw = DB::table('QPAccountsDB.dbo.OrderWithDraw')
|
|
|
+ ->lock('WITH(NOLOCK)')
|
|
|
+ ->where('UserID', $UserID)
|
|
|
+ ->where('State', 2)
|
|
|
+ ->exists();
|
|
|
+ $retval['has_success_withdraw'] = $hasSuccessWithdraw;
|
|
|
return apiReturnSuc($retval);
|
|
|
}
|
|
|
public function GoWithDraw(Request $request)
|
|
|
@@ -531,6 +542,40 @@ class WithDrawInfoController
|
|
|
$user = $request->user();
|
|
|
$UserID=$user->UserID;
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ // 检查是否有成功的提现记录 (State = 2 表示成功)
|
|
|
+ $hasSuccessWithdraw = DB::table('QPAccountsDB.dbo.OrderWithDraw')
|
|
|
+ ->lock('WITH(NOLOCK)')
|
|
|
+ ->where('UserID', $UserID)
|
|
|
+ ->where('State', 2)
|
|
|
+ ->exists();
|
|
|
+
|
|
|
+ $limitKey = 'last_withdraw_info_update_' . $UserID;
|
|
|
+ if ($hasSuccessWithdraw) {
|
|
|
+
|
|
|
+ if (Redis::exists($limitKey)) {
|
|
|
+ return apiReturnFail(['web.withdraw.update_limit', 'You can only update your information once every 24 hours.']);
|
|
|
+ }
|
|
|
+ $code = $request->input('code');
|
|
|
+ if (empty($code)) {
|
|
|
+ return apiReturnFail(['web.verify.code_empty', 'Verification code cannot be empty']);
|
|
|
+ }
|
|
|
+
|
|
|
+ $phone = DB::table(TableName::QPAccountsDB() . 'AccountPhone')->where('UserID', $UserID)->value('PhoneNum');
|
|
|
+ $phone = trim(env('COUNTRY_CODE',1) . $phone);
|
|
|
+ if (empty($phone)) {
|
|
|
+ return apiReturnFail(['web.verify.phone_not_bound', 'Phone number not bound']);
|
|
|
+ }
|
|
|
+
|
|
|
+ $verifyStatus = \App\Models\GamePhoneVerityCode::verifyCode($phone, $code);
|
|
|
+ if ($verifyStatus == 1) {
|
|
|
+ return apiReturnFail(['web.verify.code_error', 'Invalid verification code']);
|
|
|
+ }
|
|
|
+ // 验证通过,清除验证码
|
|
|
+ \App\Models\GamePhoneVerityCode::clearPhoneCode($phone);
|
|
|
+ }
|
|
|
+
|
|
|
// $UserID = (int)$request->globalUser->UserID;//$request->input('UserID');
|
|
|
// $RequestDynamicPass = $request->input('DynamicPass');
|
|
|
$PixType = $request->input('cbPixType');
|
|
|
@@ -661,6 +706,9 @@ class WithDrawInfoController
|
|
|
->update($data);
|
|
|
}
|
|
|
|
|
|
+ // 记录修改时间,限制24小时
|
|
|
+ Redis::setex($limitKey, 86400, time());
|
|
|
+
|
|
|
SetNXLock::release($redisKey);
|
|
|
return apiReturnSuc();
|
|
|
}
|
|
|
@@ -1069,6 +1117,14 @@ class WithDrawInfoController
|
|
|
$info['bank_list'] = config('games.ru_bank_list');
|
|
|
}
|
|
|
|
|
|
+ // 获取绑定手机号
|
|
|
+ $phone = DB::table(TableName::QPAccountsDB() . 'AccountPhone')->where('UserID', $UserID)->value('PhoneNum');
|
|
|
+ if ($phone) {
|
|
|
+ // 简单脱敏处理,例如:5511******88
|
|
|
+ $info['bind_phone'] = substr($phone, 0, 4) . '****' . substr($phone, -2);
|
|
|
+ } else {
|
|
|
+ $info['bind_phone'] = '';
|
|
|
+ }
|
|
|
|
|
|
$AccountsInfoModel = new AccountsInfo();
|
|
|
$total = $AccountsInfoModel->accountTotalStatistics([$UserID]);
|
|
|
@@ -1076,6 +1132,12 @@ class WithDrawInfoController
|
|
|
|
|
|
$info['total_recharge'] = intval($totalRecharge);
|
|
|
$info['withdraw_level'] = env('MIN_RECHARGE',20);
|
|
|
+ $hasSuccessWithdraw = DB::table('QPAccountsDB.dbo.OrderWithDraw')
|
|
|
+ ->lock('WITH(NOLOCK)')
|
|
|
+ ->where('UserID', $UserID)
|
|
|
+ ->where('State', 2)
|
|
|
+ ->exists();
|
|
|
+ $info['has_success_withdraw'] = $hasSuccessWithdraw;
|
|
|
|
|
|
return apiReturnSuc(compact('info'));
|
|
|
}
|