Explorar el Código

fix(extract): 修复提现拒绝时额度回退逻辑

- 移除控制器中的提现额度回退代码
- 将提现额度回退逻辑迁移至UserExtractRepository
- 保持提现额度记录的插入功能
- 确保拒绝提现实现正确的额度返还机制
shichen hace 3 meses
padre
commit
f9cb142a72

+ 16 - 0
app/common/repositories/user/UserExtractRepository.php

@@ -497,6 +497,22 @@ class UserExtractRepository extends BaseRepository
497 497
                             $brokerage_price = bcadd($user['brokerage_price'] ,$extract['extract_price'],2);
498 498
                             //返回余额
499 499
                             $user->brokerage_price = $brokerage_price;
500
+                            // 拒绝提现要退回提现额度
501
+                            Db::name('user')->where('uid', $extract['uid'])->inc('withdrawal_limit', $extract['extract_price'])->save();
502
+                            // 提现额度记录
503
+                            /** @var UserRepository $userRepository */
504
+                            $userRepository = app()->make(UserRepository::class);
505
+                            $userEntity = $userRepository->getUserEntityByUid($extract['uid']);
506
+                            $recordData = [
507
+                                'user_id' => $extract['uid'],
508
+                                'pm' => UserWithdrawalLimitRecordEnum::PM['INCOME']['code'],
509
+                                'number' => $extract['extract_price'],
510
+                                'balance' => $userEntity->withdrawalLimit,
511
+                                'type_shop' => -1,
512
+                                'order_sn' => '',
513
+                                'remark' => '提现拒绝增加提现额度'
514
+                            ];
515
+                            Db::name('user_withdrawal_limit_records')->insert($recordData);
500 516
                         }
501 517
                     }else{
502 518
                         if($extract['type']==3){

+ 0 - 20
app/controller/admin/user/UserExtract.php

@@ -261,26 +261,6 @@ class UserExtract extends BaseController
261 261
                 $eb_bill = Db::name('entropy_barter_bill')->where('order_no', $extract_data['order_sn'])->where('pm', 2)->find();
262 262
                 Db::name('entropy_barter_user_' . $extract_data['mer_id'])->where('eb_id', $eb_bill['to_id'])->inc('wallet', $extract_data['extract_price'])->update();
263 263
             }
264
-
265
-            // 拒绝提现要退回提现额度
266
-            if ($extract_data['withdrawal_type'] == 3) {
267
-                // 提现额度
268
-                Db::name('user')->where('uid',$extract_data['uid'])->inc('withdrawal_limit',$extract_data['extract_price'])->save();
269
-                // 提现额度记录
270
-                /** @var UserRepository $userRepository */
271
-                $userRepository = app()->make(UserRepository::class);
272
-                $userEntity = $userRepository->getUserEntityByUid($extract_data['uid']);
273
-                $recordData = [
274
-                    'user_id' => $extract_data['uid'],
275
-                    'pm' => UserWithdrawalLimitRecordEnum::PM['INCOME']['code'],
276
-                    'number' => $extract_data['extract_price'],
277
-                    'balance' => $userEntity->withdrawalLimit,
278
-                    'type_shop' => -1,
279
-                    'order_sn' => '',
280
-                    'remark' => '提现拒绝增加提现额度'
281
-                ];
282
-                Db::name('user_withdrawal_limit_records')->insert($recordData);
283
-            }
284 264
         }
285 265
         $this->repository->switchStatus($id, $data);
286 266
         Db::name('user_extract')->where('extract_id', $id)->update($data);