vendor/codeages/biz-order-pay/src/Pay/Service/Impl/AccountServiceImpl.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Codeages\Biz\Pay\Service\Impl;
use Codeages\Biz\Framework\Util\ArrayToolkit;
use Codeages\Biz\Pay\Util\RandomToolkit;
use Codeages\Biz\Pay\Service\AccountService;
use Codeages\Biz\Framework\Service\BaseService;
use Codeages\Biz\Framework\Service\Exception\ServiceException;
class AccountServiceImpl extends BaseService implements AccountService
{
public function setPayPassword($userId, $password)
{
if (empty($this->biz['user'])) {
throw $this->createAccessDeniedException('user is not login.');
}
if ($userId != $this->biz['user']['id']) {
throw $this->createAccessDeniedException('current user is invalid.');
}
$account = $this->getPayAccountDao()->getByUserId($userId);
try {
$this->beginTransaction();
if (empty($account)) {
$account = $this->getPayAccountDao()->create(array(
'user_id' => $userId
));
}
$salt = RandomToolkit::generateString();
$passwordEncoder = $this->getPasswordEncoder();
$password = $passwordEncoder->encodePassword($password, $salt);
$account = $this->getPayAccountDao()->update($account['id'], array(
'salt' => $salt,
'password' => $password
));
$this->commit();
} catch (\Exception $e) {
$this->rollback();
throw new ServiceException($e->getMessage());
}
return $account;
}
public function isPayPasswordSetted($userId)
{
$account = $this->getPayAccountDao()->getByUserId($userId);
return !empty($account);
}
public function isSecurityAnswersSetted($userId)
{
$savedAnswers = $this->getSecurityAnswerDao()->findByUserId($userId);
return !empty($savedAnswers);
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。