|
|
@@ -9,7 +9,10 @@
|
|
9
|
9
|
*/
|
|
10
|
10
|
namespace app\controller\admin\user;
|
|
11
|
11
|
|
|
|
12
|
+use app\common\enum\CommonEnum;
|
|
|
13
|
+use app\common\enum\user\UserWithdrawalLimitRecordEnum;
|
|
12
|
14
|
use app\common\repositories\user\UserRepository;
|
|
|
15
|
+use app\common\repositories\user\UserWithdrawalLimitRecordRepository;
|
|
13
|
16
|
use crmeb\basic\BaseController;
|
|
14
|
17
|
use crmeb\services\SpreadsheetExcelService;
|
|
15
|
18
|
use think\App;
|
|
|
@@ -166,8 +169,23 @@ class UserExtract extends BaseController
|
|
166
|
169
|
if ($userEntity->getWithdrawalLimit() < $extract_data['extract_price']) {
|
|
167
|
170
|
return app('json')->fail('提现额度不足');
|
|
168
|
171
|
} else {
|
|
169
|
|
- $withdrawalLimit = bcsub($userEntity->getWithdrawalLimit(), $extract_data['extract_price'], 2);
|
|
170
|
|
- $userRepository->update($userEntity->getUid(), ['withdrawal_limit' => $withdrawalLimit]);
|
|
|
172
|
+ try {
|
|
|
173
|
+ /** @var UserWithdrawalLimitRecordRepository $userWithdrawalLimitRecordRepository */
|
|
|
174
|
+ $userWithdrawalLimitRecordRepository = app()->make(UserWithdrawalLimitRecordRepository::class);
|
|
|
175
|
+ // 添加扣减记录
|
|
|
176
|
+ $userWithdrawalLimitRecordEntity = $userWithdrawalLimitRecordRepository->addUserWithdrawalLimitRecord(
|
|
|
177
|
+ (int)$userEntity->getUid(),
|
|
|
178
|
+ UserWithdrawalLimitRecordEnum::PM['INCOME']['code'],
|
|
|
179
|
+ (float)$extract_data['extract_price'],
|
|
|
180
|
+ -1,
|
|
|
181
|
+ '',
|
|
|
182
|
+ '提现扣减提现额度'
|
|
|
183
|
+ );
|
|
|
184
|
+ // 结算扣减记录
|
|
|
185
|
+ $userWithdrawalLimitRecordRepository->executeByIdList([$userWithdrawalLimitRecordEntity->getId()]);
|
|
|
186
|
+ } catch (\Throwable $exception) {
|
|
|
187
|
+ return app('json')->fail($exception->getMessage());
|
|
|
188
|
+ }
|
|
171
|
189
|
}
|
|
172
|
190
|
|
|
173
|
191
|
if($extract_data['extract_type']==1){
|