'checkJoin', ]; public function sceneJoin() { return $this->only(['id']); } /** * @notes 校验开通vip * @param $id * @param $rule * @param $data * @return bool|string * @author BD * @date 2024/02/22 10:54 */ protected function checkJoin($id, $rule, $data) { //判断会员等级是否存在 $member = UserMember::where(['id' => $data['id']])->findOrEmpty(); if ($member->isEmpty()) { return 'network.parameterAbnormality'; } //判断当前会员等级 $member_id = UtilsService::get_user_member_id($data['user_id']); $user_member = UserMember::where(['id' => $member_id])->findOrEmpty(); if ($user_member['price'] >= $member['price']) { return 'network.parameterAbnormality';//已开通当前会员,请勿重复开通 } //判断余额 $user = User::where(['id' => $data['user_id']])->findOrEmpty(); if($member['price'] - $user['user_money'] > 0) return 'network.parameterAbnormality';//余额不足 //支付密码 $userAccountSafeCache = new UserAccountSafeCache(); if (empty($data['pay_pwd'])) { $userAccountSafeCache->record(); return 'network.parameterAbnormality';//请输入密码 } if (strlen($data['pay_pwd']) != 6) { $userAccountSafeCache->record(); return 'network.parameterAbnormality';//请输入正确的密码 } //账号安全机制,连续输错后锁定,防止账号密码暴力破解 if (!$userAccountSafeCache->isSafe()) { return 'network.frequentOperation'; //密码连续' . $userAccountSafeCache->count . '次输入错误,请' . $userAccountSafeCache->minute . '分钟后重试 } $passwordSalt = Config::get('project.unique_identification'); if ($user['password_pay'] !== create_password($data['pay_pwd'], $passwordSalt)) { $userAccountSafeCache->record(); return 'common.payPwdError';//密码错误 } $userAccountSafeCache->relieve(); return true; } }