This commit is contained in:
chenbo 2023-09-11 10:27:13 +08:00
parent 6107e53b14
commit ae32006a6e

View File

@ -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('余额不足');
}