| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 | <?phpnamespace App\Http\Controllers\Web\Common;use Aix\Sms\Contracts\Smser;use App\Http\Controllers\Web\WebBaseController;use App\Services\Auth\AuthService;use App\Services\Common\GeetestService;use App\Services\Common\SmsService;use App\Validators\SmsValidatorRequest;class SmsController extends WebBaseController{    /**     * @var SmsService     */    protected $smsService;    /**     * @var GeetestService     */    private $geetestService;    /**     * @var AuthService     */    private $authService;    /**     * CommonController constructor.     * @param AuthService $authService     * @param SmsService $smsService     * @param GeetestService $geetestService     */    public function __construct(AuthService $authService, SmsService $smsService, GeetestService $geetestService)    {        $this->smsService = $smsService;        $this->geetestService = $geetestService;        $this->authService = $authService;    }    public function sendSms(SmsValidatorRequest $smsValidatorRequest)    {        $method=$smsValidatorRequest->type.'Sms';        $result=$this->$method($smsValidatorRequest->mobile);        return $result;    }    protected function loginSms($mobile)    {        if (!$this->authService->checkUser($mobile, "", 2)) {            return $this->sendErrorResponse("该手机号码没有绑定账号,请先注册");        }        $this->smsService->sendAuthSms($mobile, Smser::TEMPLATE_AUTH_LOGIN);        return $this->sendSuccessResponse();    }    protected function registerSms($mobile)    {//        if (config('aix.system.site_safety.site_vo_code.captcha_open') == 1) {//            if (!$this->geetestService->checkGeetest()) {//                return $this->sendErrorResponse("验证码不通过,请重新验证");//            }//        }        $this->smsService->sendAuthSms($mobile, Smser::TEMPLATE_AUTH_REGISTER);        return $this->sendSuccessResponse();    }    protected function checkSms($mobile)    {//        if (config('aix.system.site_safety.site_vo_code.captcha_open') == 1) {//            if (!$this->geetestService->checkGeetest()) {//                return $this->sendErrorResponse("验证码不通过,请重新验证");//            }//        }        $this->smsService->sendAuthSms($mobile, Smser::TEMPLATE_AUTH_CHECK);        return $this->sendSuccessResponse();    }}
 |