src/ApiBundle/Api/Resource/SmsCenter/SmsCenter.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace ApiBundle\Api\Resource\SmsCenter;
use ApiBundle\Api\ApiRequest;
use ApiBundle\Api\Resource\AbstractResource;
use ApiBundle\Api\Annotation\ApiConf;
use Biz\Common\BizSms;
use Biz\Common\CommonException;
use Biz\System\SettingException;
class SmsCenter extends AbstractResource
{
private $smsType = array(
'register' => BizSms::SMS_BIND_TYPE,
);
/**
* @ApiConf(isRequiredAuth=false)
*/
public function add(ApiRequest $request)
{
$type = $request->request->get('type');
if ('register' == $type) {
$auth = $this->getSettingService()->get('auth', array());
if (!(isset($auth['register_mode']) && in_array($auth['register_mode'], array('mobile', 'email_or_mobile')))) {
throw SettingException::FORBIDDEN_MOBILE_REGISTER();
}
}
if (!($type = $request->request->get('type'))
|| !($mobile = $request->request->get('mobile'))) {
throw CommonException::ERROR_PARAMETER_MISSING();
}
$type = $this->convertType($type);
$smsToken = $this->getBizSms()->send($type, $mobile);
$this->getUserService()->updateSmsRegisterCaptchaStatus($request->getHttpRequest()->getClientIp());
return array(
'smsToken' => $smsToken['token'],
);
}
private function convertType($type)
{
if (!array_key_exists($type, $this->smsType)) {
throw CommonException::ERROR_PARAMETER();
}
return $this->smsType[$type];
}
/**
* @return BizSms
*/
private function getBizSms()
{
return $this->biz['biz_sms'];
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。