|
|
@@ -566,7 +566,55 @@ class WithDrawInfoController
|
|
|
$user = $request->user();
|
|
|
$UserID=$user->UserID;
|
|
|
|
|
|
+ // 提前解析输入字段
|
|
|
+ $PixType = $request->input('cbPixType');
|
|
|
+ $BankUserName = urldecode($request->input('userName'));
|
|
|
+ $EmailAddress = $request->input('email');
|
|
|
+ $PixNum = $request->input('PixNum');
|
|
|
+
|
|
|
+ if(!empty($EmailAddress))$EmailAddress=Util::cleanEmptyString($EmailAddress);
|
|
|
+ if(!empty($PixNum))$PixNum=Util::cleanEmptyString($PixNum);
|
|
|
+
|
|
|
+ if (!empty($EmailAddress)&&!Util::validateEmail($EmailAddress)) {
|
|
|
+ return apiReturnFail(['web.user.email_fail','Wrong email format']);
|
|
|
+ }
|
|
|
|
|
|
+ // 获取已有的提现信息,用于判断是否只修改了PixType
|
|
|
+ $AccountWithDrawInfo = DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
|
|
|
+ ->lock('WITH(NOLOCK)')
|
|
|
+ ->where('UserID', $UserID)
|
|
|
+ ->first();
|
|
|
+
|
|
|
+ // 检查是否只修改了PixType
|
|
|
+ $onlyPixTypeChanged = false;
|
|
|
+ if ($AccountWithDrawInfo) {
|
|
|
+ // 构建待比较的数据
|
|
|
+ $compareData = [];
|
|
|
+ if ($PixType == 1) {
|
|
|
+ $comparePixNum = $PixNum;
|
|
|
+ if (!empty($comparePixNum) && substr($comparePixNum, 0, 1) !== '$') {
|
|
|
+ $comparePixNum = '$' . $comparePixNum;
|
|
|
+ }
|
|
|
+ $compareData = compact('PixType', 'BankUserName', 'PixNum');
|
|
|
+ $compareData['PixNum'] = $comparePixNum;
|
|
|
+ } else {
|
|
|
+ $compareData = compact('PixType', 'EmailAddress');
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach ($compareData as $key => &$val) {
|
|
|
+ $compareData[$key] = trim($val);
|
|
|
+ }
|
|
|
+ unset($val);
|
|
|
+
|
|
|
+ $changedFields = [];
|
|
|
+ foreach ($compareData as $field => $newValue) {
|
|
|
+ $oldValue = $AccountWithDrawInfo->$field ?? null;
|
|
|
+ if ((string)$oldValue !== (string)$newValue) {
|
|
|
+ $changedFields[] = $field;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $onlyPixTypeChanged = count($changedFields) === 1 && $changedFields[0] === 'PixType';
|
|
|
+ }
|
|
|
|
|
|
// 检查是否有成功的提现记录 (State = 2 表示成功)
|
|
|
$hasSuccessWithdraw = DB::table('QPAccountsDB.dbo.OrderWithDraw')
|
|
|
@@ -576,7 +624,7 @@ class WithDrawInfoController
|
|
|
->exists();
|
|
|
|
|
|
$limitKey = 'last_withdraw_info_update_' . $UserID;
|
|
|
- if ($hasSuccessWithdraw) {
|
|
|
+ if ($hasSuccessWithdraw && !$onlyPixTypeChanged) {
|
|
|
|
|
|
if (Redis::exists($limitKey)) {
|
|
|
return apiReturnFail(['web.withdraw.update_limit', 'You can only update your information once every 24 hours.']);
|
|
|
@@ -603,20 +651,6 @@ class WithDrawInfoController
|
|
|
Redis::del('withdraw_info_time_' . $UserID);
|
|
|
}
|
|
|
|
|
|
-// $UserID = (int)$request->globalUser->UserID;//$request->input('UserID');
|
|
|
-// $RequestDynamicPass = $request->input('DynamicPass');
|
|
|
- $PixType = $request->input('cbPixType');
|
|
|
- $BankUserName = urldecode($request->input('userName'));
|
|
|
- $EmailAddress = $request->input('email');
|
|
|
- $PixNum = $request->input('PixNum');
|
|
|
-
|
|
|
- if(!empty($EmailAddress))$EmailAddress=Util::cleanEmptyString($EmailAddress);
|
|
|
- if(!empty($PixNum))$PixNum=Util::cleanEmptyString($PixNum);
|
|
|
-
|
|
|
- if (!empty($EmailAddress)&&!Util::validateEmail($EmailAddress)) {
|
|
|
- return apiReturnFail(['web.user.email_fail','Wrong email format']);
|
|
|
- }
|
|
|
-
|
|
|
$redisKey = 'withDrawInfo_withDrawInfo_'.$UserID;
|
|
|
if (!SetNXLock::getExclusiveLock($redisKey)) {
|
|
|
Util::WriteLog("withdrawInfo",[1, $request->all()]);
|
|
|
@@ -709,11 +743,13 @@ class WithDrawInfoController
|
|
|
}
|
|
|
unset($val);
|
|
|
|
|
|
-
|
|
|
- $AccountWithDrawInfo = DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
|
|
|
- ->lock('WITH(NOLOCK)')
|
|
|
- ->where('UserID', $UserID)
|
|
|
- ->first();
|
|
|
+ // 如果 $AccountWithDrawInfo 尚未获取(首次保存),在此获取
|
|
|
+ if ($AccountWithDrawInfo === null) {
|
|
|
+ $AccountWithDrawInfo = DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
|
|
|
+ ->lock('WITH(NOLOCK)')
|
|
|
+ ->where('UserID', $UserID)
|
|
|
+ ->first();
|
|
|
+ }
|
|
|
if (!$AccountWithDrawInfo) {
|
|
|
$data['UserID'] = $UserID;
|
|
|
$data['Achieves'] = 0;
|