From ae32006a6e9d2d6ed061cd6bb643acd001ca6363 Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Mon, 11 Sep 2023 10:27:13 +0800 Subject: [PATCH] update --- app/api/logic/UserLogic.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/api/logic/UserLogic.php b/app/api/logic/UserLogic.php index 7e0c35278..d88206e84 100755 --- a/app/api/logic/UserLogic.php +++ b/app/api/logic/UserLogic.php @@ -18,12 +18,12 @@ use app\common\{enum\notice\NoticeEnum, enum\user\UserTerminalEnum, enum\YesNoEnum, logic\BaseLogic, + model\Company, model\user\User, model\user\UserAuth, model\user\Withdraw, service\sms\SmsDriver, - service\wechat\WeChatMnpService -}; + service\wechat\WeChatMnpService}; use app\common\model\dict\DictData; use app\common\model\user\UserAccountLog; use think\db\exception\DataNotFoundException; @@ -307,8 +307,13 @@ class UserLogic extends BaseLogic throw new DataNotFoundException('用户不存在'); } + $company = Company::find(['id'=>$user->company_id]); + if ($company->isEmpty()) { + throw new DataNotFoundException('账户异常,关联公司不存在'); + } + // 是否有在途的提现申请 - $withdraw = Withdraw::where(['user_id'=>$params['user_id'], 'status'=>0])->find(); + $withdraw = Withdraw::where(['user_id'=>$params['user_id'], 'company_id'=>$company->id, 'status'=>0])->find(); if (!empty($withdraw)) { throw new ValidateException('您已有一笔待审核的提现申请'); } @@ -319,7 +324,7 @@ class UserLogic extends BaseLogic } // 校验提现金额 - if ($params['amount'] > $user['user_money']) { + if ($params['amount'] > $company->company_money) { throw new ValidateException('余额不足'); }